public class CdiComponentProvider extends Object implements ComponentProvider, javax.enterprise.inject.spi.Extension
Jersey component provider
to serve CDI beans
obtained from the actual CDI bean manager.
To properly inject JAX-RS/Jersey managed beans into CDI, it also
serves as a CDI Extension
, that intercepts CDI injection targets.Modifier and Type | Class and Description |
---|---|
static class |
CdiComponentProvider.CdiDefaultAnnotation
Auxiliary annotation for mocked beans used to cover Jersey/HK2 injected injection points.
|
Modifier and Type | Field and Description |
---|---|
protected javax.enterprise.inject.spi.BeanManager |
beanManager |
static String |
CDI_CLASS_ANALYZER
Name to be used when binding CDI injectee skipping class analyzer to HK2 service injection manager.
|
Constructor and Description |
---|
CdiComponentProvider() |
Modifier and Type | Method and Description |
---|---|
static void |
addHK2DepenendencyCheck(Predicate<Class<?>> predicate)
Add a predicate to test HK2 dependency to create a CDI bridge bean to HK2 for it.
|
boolean |
bind(Class<?> component,
ContractProvider contractProvider)
Jersey will invoke this method before binding of each component class internally
during initialization of it's injection manager.
|
boolean |
bind(Class<?> clazz,
Set<Class<?>> providerContracts)
Jersey will invoke this method before binding of each component class internally
during initialization of it's injection manager.
|
void |
done()
Jersey will invoke this method after all component classes have been bound.
|
org.glassfish.jersey.internal.inject.InjectionManager |
getEffectiveInjectionManager()
Gets you effective injection manager.
|
void |
initialize(org.glassfish.jersey.internal.inject.InjectionManager injectionManager)
Initializes the component provider with a reference to a injection manager
instance, which will get used in the application to manage individual components.
|
void |
processAnnotatedType(javax.enterprise.inject.spi.ProcessAnnotatedType processAnnotatedType) |
public static final String CDI_CLASS_ANALYZER
protected volatile javax.enterprise.inject.spi.BeanManager beanManager
public void initialize(org.glassfish.jersey.internal.inject.InjectionManager injectionManager)
ComponentProvider
initialize
in interface ComponentProvider
injectionManager
- an injection manager.public boolean bind(Class<?> clazz, Set<Class<?>> providerContracts)
ComponentProvider
bind
in interface ComponentProvider
clazz
- a component (resource/provider) class.providerContracts
- provider contracts implemented by given component.public boolean bind(Class<?> component, ContractProvider contractProvider)
ComponentProvider
bind
in interface ComponentProvider
component
- a component (resource/provider) class.contractProvider
- optional registered ContractProvider
of the component.public void done()
ComponentProvider
done
in interface ComponentProvider
public void processAnnotatedType(javax.enterprise.inject.spi.ProcessAnnotatedType processAnnotatedType)
public org.glassfish.jersey.internal.inject.InjectionManager getEffectiveInjectionManager()
Copyright © 2007-2023, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.