Class SupplierThreadScopeBean

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 SupplierThreadScopeBean 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 {
     protected void configure() {
         bindFactory(new MyFactoryInjectionProvider())
Inject example:
 public class MyResource {
   private MyBean myBean;
  • Method Details

    • getScope

      public Class<? extends Annotation> getScope()
      Specified by:
      getScope in interface jakarta.enterprise.inject.spi.BeanAttributes<Object>
      getScope in class JerseyBean<Object>
    • 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>
      destroy in class JerseyBean<Object>
    • getBeanClass

      public Class<?> getBeanClass()
      Specified by:
      getBeanClass in interface jakarta.enterprise.inject.spi.Bean<Object>
      getBeanClass in class JerseyBean<Object>