Class Injectors


  • public class Injectors
    extends java.lang.Object
    Factory for CDI style Injectors.

    This mimics CDI style injection, which supports all features of Jakarta Inject, and additionally:

    • The Produces annotation on fields and methods
    • The Default annotation is added to sources when not annotated with any qualifiers or only annotated with Named and/or Any annotations
    • The Default annotation is added to targets when not annotated with any other qualifiers
    • The Any annotation is always added to all sources
    Not supported are:
    • Interceptors, Decorators and Events
    • Extensions via Jakarta Enterprise Inject SPI; instead use the provided SPI
    • Lifecycle management for sources created by producers
    There is partial support for:
    • The Instance extension of Provider
    Other differences:
    • Proxies are only available when the optional proxy extension is on the class path
    • Proxies are only created to resolve scope conflicts, but not to resolve circular dependencies
    • Exceptions thrown by the injector are of a different type with different messages
    • Sources can still be added and removed after initialization if so desired