Class ApplicationScopedBeanInterceptorHandler

  • All Implemented Interfaces:
    jakarta.inject.Provider, Serializable

    public class ApplicationScopedBeanInterceptorHandler
    extends NormalScopedBeanInterceptorHandler

    This is a Provider especially 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
    • Constructor Detail

      • ApplicationScopedBeanInterceptorHandler

        public ApplicationScopedBeanInterceptorHandler​(jakarta.enterprise.inject.spi.BeanManager beanManager,
                                                       jakarta.enterprise.inject.spi.Bean<?> bean)