requestscope

What is the correct way to use RequestScoped Bean and rendered attribute?

一曲冷凌霜 提交于 2019-12-20 06:48:25
问题 does anybody know how to use RequestScoped bean together with rendered attribute in jsf? The rendered attribute is evaluated before applyValues phase and therefore is not correctly evaluated. I don't want to preserve any state. The example could be an outputPanel with a datatable and a button. The datatable gets a list of values. The wrapping outputPanel has the rendered attribute like: <p:outputPanel rendered="#{not empty requestScopedBean.dataList}"> <p:datatable value="#{requestScopedBean

instanciation of a request scoped bean

无人久伴 提交于 2019-12-11 04:13:04
问题 A request scoped bean in spring means that the container create a single bean instance per HTTP request. Let say I have a RequestScopedBean bean : @Component public class RequestScopedBean { @PostConstruct void init() { System.out.println("Init method called for each incoming HTTP Request"); } } public void doSomething() {} Configuration : @Configuration public class MyBeansConfig { @Bean @Scope(value="request", proxyMode=TARGET_CLASS) public RequestScopedBean requestScopedBean() { return new

ThreadStatic in asynchronous ASP.NET Web API

跟風遠走 提交于 2019-12-10 16:48:05
问题 Is there a possibility to use thread static like variables within a single request? The current code uses a thread static variable for logging purposes and now we want to use async controller methods (with async and await pattern) which results in problems because the variable is null when a new thread is opened. 回答1: await can cause thread jumps, so thread static variables will naturally cause problems. To work around this, you can either use AsyncLocal<T> (available in .NET 4.6), or (if you

Does Spring's @RequestScope automatically handle proxying when injected in singleton beans?

五迷三道 提交于 2019-12-07 15:37:52
问题 I'm using a Java8/Spring Boot 2 application. I want to inject a request-scoped bean into a singleton bean. The official documentation highlights that either a proxy or ObjectFactory/Provider should be used to ensure always getting the correctly scoped bean at runtime in the singleton bean. However, the @RequestScope annotation seems to "automatically" set some kind of proxy, as explained in the answer to this question. I'm now wondering if the following three implementations are in fact

Does Spring's @RequestScope automatically handle proxying when injected in singleton beans?

人盡茶涼 提交于 2019-12-06 01:52:04
I'm using a Java8/Spring Boot 2 application. I want to inject a request-scoped bean into a singleton bean. The official documentation highlights that either a proxy or ObjectFactory/Provider should be used to ensure always getting the correctly scoped bean at runtime in the singleton bean. However, the @RequestScope annotation seems to "automatically" set some kind of proxy, as explained in the answer to this question . I'm now wondering if the following three implementations are in fact identical and which one is preferred? Approach 1: explicitly using objectFactory<> @Component @RequestScope

What is the correct way to use RequestScoped Bean and rendered attribute?

核能气质少年 提交于 2019-12-02 09:53:53
does anybody know how to use RequestScoped bean together with rendered attribute in jsf? The rendered attribute is evaluated before applyValues phase and therefore is not correctly evaluated. I don't want to preserve any state. The example could be an outputPanel with a datatable and a button. The datatable gets a list of values. The wrapping outputPanel has the rendered attribute like: <p:outputPanel rendered="#{not empty requestScopedBean.dataList}"> <p:datatable value="#{requestScopedBean.dataList}"> ... </p:datatable> <p:commandButton action="#{requestScopedBean.someAction}" /> </p