public class SupplierThreadScopeBean extends JerseyBean<Object>
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;
}
| Modifier and Type | Method and Description |
|---|---|
Object |
create(javax.enterprise.context.spi.CreationalContext<Object> ctx) |
void |
destroy(Object instance,
javax.enterprise.context.spi.CreationalContext<Object> creationalContext) |
Class<?> |
getBeanClass() |
Class<? extends Annotation> |
getScope() |
getId, getInjectionPoints, getName, getQualifiers, getRank, getStereotypes, getTypes, isAlternative, isNullable, transformScopepublic Class<? extends Annotation> getScope()
getScope in interface javax.enterprise.inject.spi.BeanAttributes<Object>getScope in class JerseyBean<Object>public void destroy(Object instance, javax.enterprise.context.spi.CreationalContext<Object> creationalContext)
destroy in interface javax.enterprise.context.spi.Contextual<Object>destroy in class JerseyBean<Object>public Class<?> getBeanClass()
getBeanClass in interface javax.enterprise.inject.spi.Bean<Object>getBeanClass in class JerseyBean<Object>Copyright © 2007-2024,Oracleand/or its affiliates.All Rights Reserved. Use is subject to license terms.