Class InitializableSupplierThreadScopeBean

  • All Implemented Interfaces:
    jakarta.enterprise.context.spi.Contextual<Object>, jakarta.enterprise.inject.spi.Bean<Object>, jakarta.enterprise.inject.spi.BeanAttributes<Object>, jakarta.enterprise.inject.spi.PassivationCapable

    public class InitializableSupplierThreadScopeBean
    extends JerseyBean<Object>
    Creates an implementation of Bean interface using Jersey's SupplierInstanceBinding. Binding provides the information about the bean also called BeanAttributes information. The Bean does not use JerseyInjectionTarget because serves already created proxy, therefore the create operation just return provided instance without any other contextual operation (produce, inject, destroy).

    This bean is special and is used only for service registered as a PerThread and works through the proxy which serves the correct instance per the given thread.

    Register example:

     AbstractBinder {
         @Override
         protected void configure() {
             bindFactory(new MyFactoryInjectionProvider())
                  .to(MyBean.class)
                  .in(PerThread.class);
         }
     }
     
    Inject example:
     @Path("/")
     public class MyResource {
       @Inject
       private MyBean myBean;
     }
     
    • Method Detail

      • create

        public Object create​(jakarta.enterprise.context.spi.CreationalContext<Object> ctx)
      • destroy

        public void destroy​(Object instance,
                            jakarta.enterprise.context.spi.CreationalContext<Object> creationalContext)
        Specified by:
        destroy in interface jakarta.enterprise.context.spi.Contextual<Object>
        Overrides:
        destroy in class JerseyBean<Object>