Package jakarta.enterprise.inject.spi
The portable extension integration SPI.
A portable extension may integrate with the container by:
- Providing its own beans, interceptors and decorators to the container
- Injecting dependencies into its own objects using the dependency injection service
- Providing a context implementation for a custom scope
- Augmenting or overriding the annotation-based metadata with metadata from some other source
The BeanManager object
 
 Portable extensions sometimes interact directly with the container 
 via programmatic API call. The interface 
 BeanManager provides operations 
 for obtaining contextual references for beans, along with many other 
 operations of use to portable extensions.
Container lifecycle events
During the application initialization process, the container fires 
 a series of events, allowing 
 portable extensions to integrate with the container initialization 
 process. Observer methods of these events must belong to
 extensions declared 
 in META-INF/services.
Lifecycle events include
 BeforeBeanDiscovery,
 AfterBeanDiscovery,
 AfterDeploymentValidation and
 BeforeShutdown.
Interfaces representing enabled beans
The interfaces 
 Bean,
 Decorator,
 Interceptor and
 ObserverMethod
 define everything the container needs to manage instances of 
 a bean, interceptor, decorator or observer method.
An instance of Bean exists for every
 enabled bean. A portable 
 extension may add support for new kinds of beans by implementing 
 Bean, observing the event
 AfterBeanDiscovery event 
 registering beans with the container. An instance of 
 ObserverMethod exists for every
 observer method of every 
 enabled bean. A portable extension may add observers by implementing 
 ObserverMethod and
 registering an instance with the container.
A portable extension may be notified of the existence of an
 enabled bean by observing the container lifecycle event type 
 ProcessBean or one of its 
 subtypes,
 or of the existence of an observer method of an enabled bean by 
 observing the event type
 ProcessObserverMethod.
Alternate metadata sources
A portable extension may provide an alternative metadata source, such as configuration by XML.
Annotated
 and its subtypes allow a portable extension to specify 
 metadata that overrides the annotations that exist on a 
 bean class. The portable extension is responsible for 
 implementing the interfaces, thereby exposing the metadata 
 to the container. The container must use the operations of 
 Annotated and its subinterfaces to discover program
 element types and annotations, instead of directly calling the 
 Java Reflection API.
A portable extension provides its metadata to the 
 container by observing the event 
 ProcessAnnotatedType and 
 wrapping the AnnotatedType.
Producer and InjectionTarget
 
 The interfaces Producer and
 InjectionTarget abstract the 
 basic lifecycle of (contextual or non-contextual) container managed 
 objects, including instantiation and destruction, dependency injection 
 and lifecycle callbacks.
An instance of InjectionTarget 
 may be product of
 BeanManager.getInjectionTargetFactory(AnnotatedType)
 obtained from the BeanManager,
 allowing a portable extension to request these container services for
 objects under the control of the portable extension.
Furthermore, a portable extension may replace the implementation
 of InjectionTarget or
 Producer used by the container
 with its own implementation by observing the events
 ProcessInjectionTarget or
 ProcessProducer.
- 
Interface Summary Interface Description AfterBeanDiscovery The event type of the second event fired by the container when it has fully completed the bean discovery process, validated that there are no definition errors relating to the discovered beans, and registeredBeanandObserverMethodobjects for the discovered beans, but before detecting deployment problems.AfterDeploymentValidation The event type of the third event fired by the container after it has validated that there are no deployment problems and before creating contexts or processing requests.AfterTypeDiscovery This event type is thrown by the container after type discovery is complete.Annotated Represents a Java program element that can be annotated.AnnotatedCallable<X> Represents a callable member of a Java type.AnnotatedConstructor<X> Represents a constructor of a Java class.AnnotatedField<X> Represents a field of a Java class.AnnotatedMember<X> Represents a member of a Java type.AnnotatedMethod<X> Represents a method of a Java type.AnnotatedParameter<X> Represents a parameter of a method or constructor.AnnotatedType<X> Represents a Java class or interface.Bean<T> Represents an enabled bean.BeanAttributes<T> The BeanAttributes interface exposes the basic attributes of a bean.BeanContainer BeanContaineris a superclass ofBeanManagercontaining capabilities that are portable across all CDI environments.BeanManager Allows a portable extension to interact directly with the container.BeforeBeanDiscovery This event type is thrown by the container before the bean discovery process begins.BeforeShutdown The type of the final event the container fires after it has finished processing requests and destroyed all contexts.CDIProvider Interface implemented by a CDI provider to provide access to the current containerDecorator<T> Represents an enabled decorator.EventContext<T> Represents a context of a fired event.EventMetadata Provides access to metadata about an observed event payload.Extension Service interface implemented by extensions.InjectionPoint Provides access to metadata about an injection point.InjectionTarget<T> Provides operations for performing dependency injection and lifecycle callbacks on an instance of a type.InjectionTargetFactory<T> AnInjectionTargetFactorycan create anInjectionTargetfor a given bean.InterceptionFactory<T> InterceptionFactoryallows to create a wrapper instance whose method invocations are intercepted by method interceptors and forwarded to a provided instance.Interceptor<T> Represents an enabled interceptor.ObserverMethod<T> Represents an observer method of an enabled bean.PassivationCapable Indicates that a custom implementation ofBeanorContextualis passivation capable.Prioritized This interface allows some SPI implementation to change their priority programmatically.ProcessAnnotatedType<X> The container fires an event of this type for each Java class or interface it discovers in a bean archive, before it reads the declared annotations.ProcessBean<X> The container fires an event of this type for each enabled bean, interceptor or decorator deployed in a bean archive, before registering theBeanobject.ProcessBeanAttributes<T> The container fires an event of this type for each enabled bean, interceptor or decorator deployed in a bean archive before registering theBeanobject.ProcessInjectionPoint<T,X> The container fires an event of this type for every injection point of every Java EE component class supporting injection that may be instantiated by the container at runtime, including every managed bean declared usingjakarta.annotation.ManagedBean, EJB session or message-driven bean, enabled bean, enabled interceptor or enabled decorator.ProcessInjectionTarget<X> The container fires an event of this type for every Java EE component class supporting injection that may be instantiated by the container at runtime, including every managed bean declared usingjakarta.annotation.ManagedBean, EJB session or message-driven bean, enabled bean, enabled interceptor or enabled decorator.ProcessManagedBean<X> The container fires an event of this type for each enabled managed bean, before registering theBeanobject.ProcessObserverMethod<T,X> The container fires an event of this type for each observer method of each enabled bean, before registering theObserverMethodobject.ProcessProducer<T,X> The container fires an event of this type for each producer method or field of each enabled bean, including resources.ProcessProducerField<T,X> The container fires an event of this type for each enabled producer field, before registering theBeanobject.ProcessProducerMethod<T,X> The container fires an event of this type for each enabled producer method, before registering theBeanobject.ProcessSessionBean<X> The container fires an event of this type for each enabled session bean, before registering theBeanobject.ProcessSyntheticAnnotatedType<X> The container fires an event of this type for each Java class or interface added byBeforeBeanDiscovery.addAnnotatedType(AnnotatedType, String)orAfterTypeDiscovery.addAnnotatedType(AnnotatedType, String)ProcessSyntheticBean<X> The container fires an event of this type for each custom bean implementation added throughAfterBeanDiscovery.addBean()orAfterBeanDiscovery.addBean(Bean), before registering theBeanobject.ProcessSyntheticObserverMethod<T,X> The container fires an event of this type for each custom implementation ofObserverMethodadded throughAfterBeanDiscovery.addObserverMethod(ObserverMethod)orAfterBeanDiscovery.addObserverMethod(), before registering theObserverMethodobject.Producer<T> Provides a generic operation for producing an instance of a type.ProducerFactory<X> AnProducerFactorycan create anProducerfor a given bean.
- 
Class Summary Class Description CDI<T> Provides access to the current container.Unmanaged<T> Helper class for injecting and calling lifecycle callbacks unmanaged instances for use by framework and library integrators.Unmanaged.UnmanagedInstance<T> Represents a non-contextual instance.
- 
Enum Summary Enum Description InterceptionType Identifies the kind of lifecycle callback, EJB timeout method or business method interception.SessionBeanType Identifies the kind of EJB session bean.
- 
Exception Summary Exception Description DefinitionException Thrown when a definition error occurs.DeploymentException Thrown when a deployment problem occurs.
- 
Annotation Types Summary Annotation Type Description WithAnnotations WithAnnotationsmay be applied to any portable extension observer method with an event parameter type ofProcessAnnotatedTypeto filter the events delivered.