Class CdiComponentProvider

  • All Implemented Interfaces:
    jakarta.enterprise.inject.spi.Extension, ComponentProvider

    public class CdiComponentProvider
    extends Object
    implements ComponentProvider, jakarta.enterprise.inject.spi.Extension
    Jersey CDI integration implementation. Implements 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.
    Author:
    Jakub Podlesak
    • Field Detail

      • CDI_CLASS_ANALYZER

        public static final String CDI_CLASS_ANALYZER
        Name to be used when binding CDI injectee skipping class analyzer to HK2 service injection manager.
        See Also:
        Constant Field Values
    • Constructor Detail

      • CdiComponentProvider

        public CdiComponentProvider()
    • Method Detail

      • initialize

        public void initialize​(org.glassfish.jersey.internal.inject.InjectionManager injectionManager)
        Specified by:
        initialize in interface ComponentProvider
      • processAnnotatedType

        public void processAnnotatedType​(jakarta.enterprise.inject.spi.ProcessAnnotatedType processAnnotatedType)
      • getEffectiveInjectionManager

        public org.glassfish.jersey.internal.inject.InjectionManager getEffectiveInjectionManager()
        Gets you effective injection manager.

        Note: Do NOT lower the visibility of this method. CDI proxies need at least this visibility.

        Returns:
        HK2 injection manager.
      • addHK2DepenendencyCheck

        public static void addHK2DepenendencyCheck​(Predicate<Class<?>> predicate)
        Add a predicate to test HK2 dependency to create a CDI bridge bean to HK2 for it.
        Parameters:
        predicate - to test whether given class is a HK2 dependency.