Package org.apache.webbeans.intercept
Class ApplicationScopedBeanInterceptorHandler
- java.lang.Object
-
- org.apache.webbeans.intercept.NormalScopedBeanInterceptorHandler
-
- org.apache.webbeans.intercept.ApplicationScopedBeanInterceptorHandler
-
- All Implemented Interfaces:
jakarta.inject.Provider,Serializable
public class ApplicationScopedBeanInterceptorHandler extends NormalScopedBeanInterceptorHandler
This is a
Providerespecially made for @ApplicationScoped beans.Since there is only one single contextual instance of an @ApplicationScoped bean, we can simply cache this instance inside our bean. We only need to reload this instance if it is null. This happens at the first usage and after the MethodHandler got deserialized
Also if the application uses the
AlterableContext.destroy(jakarta.enterprise.context.spi.Contextual)method on any ApplicationScoped bean, then the standard NormalScopedBeanInterceptorHandler must be configured to prevent any caching. Be careful as this might slow down your application!- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.apache.webbeans.intercept.NormalScopedBeanInterceptorHandler
bean
-
-
Constructor Summary
Constructors Constructor Description ApplicationScopedBeanInterceptorHandler(jakarta.enterprise.inject.spi.BeanManager beanManager, jakarta.enterprise.inject.spi.Bean<?> bean)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ObjectgetContextualInstance()-
Methods inherited from class org.apache.webbeans.intercept.NormalScopedBeanInterceptorHandler
get, getBean, getBeanManager, readResolve
-
-
-
-
Method Detail
-
getContextualInstance
protected Object getContextualInstance()
- Overrides:
getContextualInstancein classNormalScopedBeanInterceptorHandler
-
-