The portable extension integration SPI.
A portable extension may integrate with the container by:
Portable extensions sometimes interact directly with the container
via programmatic API call. The interface
javax.enterprise.inject.spi.BeanManager provides operations
for obtaining contextual references for beans, along with many other
operations of use to portable extensions.
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
javax.enterprise.inject.spi.BeforeBeanDiscovery,
javax.enterprise.inject.spi.AfterBeanDiscovery,
javax.enterprise.inject.spi.AfterDeploymentValidation and
javax.enterprise.inject.spi.BeforeShutdown.
The interfaces
javax.enterprise.inject.spi.Bean,
javax.enterprise.inject.spi.Decorator,
javax.enterprise.inject.spi.Interceptor and
javax.enterprise.inject.spi.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
javax.enterprise.inject.spi.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
javax.enterprise.inject.spi.ProcessBean or one of its
subtypes,
or of the existence of an observer method of an enabled bean by
observing the event type
javax.enterprise.inject.spi.ProcessObserverMethod.
A portable extension may provide an alternative metadata source, such as configuration by XML.
javax.enterprise.inject.spi.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
javax.enterprise.inject.spi.ProcessAnnotatedType and
wrapping the javax.enterprise.inject.spi.AnnotatedType.
javax.enterprise.inject.spi.Producer and
javax.enterprise.inject.spi.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 javax.enterprise.inject.spi.InjectionTarget
may be
obtained from the javax.enterprise.inject.spi.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 javax.enterprise.inject.spi.InjectionTarget or
javax.enterprise.inject.spi.Producer used by the container
with its own implementation by observing the events
javax.enterprise.inject.spi.ProcessInjectionTarget or
javax.enterprise.inject.spi.ProcessProducer.
javax.enterprise.inject, javax.enterprise.context.spi
| Modifier and Type | Interface and Description |
|---|---|
| public interface | 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 registered |
| public interface | 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. |
| public interface | AfterTypeDiscovery
This event type is thrown by the container after type discovery is complete. |
| public interface | Annotated
Represents a Java program element that can be annotated. |
| public interface | |
| public interface | |
| public interface | |
| public interface | |
| public interface | |
| public interface | AnnotatedParameter<
the type that declares the method or constructor X>Represents a parameter of a method or constructor. |
| public interface | |
| public interface | |
| public interface | BeanAttributes<
the class of the bean instance T>The BeanAttributes interface exposes the basic attributes of a bean. |
| public interface | BeanManager
Allows a portable extension to interact directly with the container. |
| public interface | BeforeBeanDiscovery
This event type is thrown by the container before the bean discovery process begins. |
| public interface | BeforeShutdown
The type of the final event the container fires after it has finished processing requests and destroyed all contexts. |
| public interface | CDIProvider
Interface implemented by a CDI provider to provide access to the current container |
| public interface | |
| public interface | |
| public interface | EventMetadata
Provides access to metadata about an observed event payload. |
| public interface | Extension
Service interface implemented by extensions. |
| public interface | InjectionPoint
Provides access to metadata about an injection point. |
| public interface | InjectionTarget<
The class of the instance T>Provides operations for performing dependency injection and lifecycle callbacks on an instance of a type. |
| public interface | InjectionTargetFactory<
type on which this InjectionTarget operates T>
An |
| public interface | InterceptionFactory<
type for which the wrapper is created T>
|
| public interface | |
| public interface | |
| public interface | PassivationCapable
Indicates that a custom implementation of |
| public interface | Prioritized
This interface allows some SPI implementation to change their priority programmatically. |
| public interface | ProcessAnnotatedType<
The class being annotated 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. |
| public interface | ProcessBean<
The class of the bean X>
The container fires an event of this type for each enabled bean, interceptor or decorator deployed in a bean archive, before
registering the |
| public interface | ProcessBeanAttributes<
The class of the bean T>
The container fires an event of this type for each enabled bean, interceptor or decorator deployed in a bean archive before
registering the |
| public interface | ProcessInjectionPoint<
the bean class of the bean that declares the injection point T, the declared type of the injection point. 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 using
|
| public interface | ProcessInjectionTarget<
The managed bean class, session bean class or Java EE component class supporting injection 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 using |
| public interface | ProcessManagedBean<
The class of the bean X>
The container fires an event of this type for each enabled managed bean, before registering the
|
| public interface | ProcessObserverMethod<
The type of the event being observed T, The bean type containing the observer method X>
The container fires an event of this type for each observer method of each
enabled bean, before registering the |
| public interface | ProcessProducer<
The bean class of the bean that declares the producer method or field T, The return type of the producer method or the type of the producer field X>The container fires an event of this type for each producer method or field of each enabled bean, including resources. |
| public interface | ProcessProducerField<
The type of the producer field T, The class of the bean declaring the producer field X>
The container fires an event of this type for each enabled producer field, before registering the
|
| public interface | ProcessProducerMethod<
The return type of the producer method T, The class of the bean declaring the producer method X>
The container fires an event of this type for each enabled producer method, before registering the
|
| public interface | ProcessSessionBean<X>
The container fires an event of this type for each enabled session bean, before registering the
|
| public interface | ProcessSyntheticAnnotatedType<
The class being annotated X>
The container fires an event of this type for each Java class or interface added by
Any observer of this event is permitted to wrap and/or replace the |
| public interface | ProcessSyntheticBean<
The class of the bean X>
The container fires an event of this type for each custom bean implementation added through
|
| public interface | ProcessSyntheticObserverMethod<
The type of the event being observed T, The bean type containing the observer method, i.e. X>ObserverMethod#getBeanClass()
The container fires an event of this type for each custom implementation of |
| public interface | Producer<
The class of object produced by the producer T>Provides a generic operation for producing an instance of a type. |
| public interface | ProducerFactory<
type of the bean containing the producer X>
An |
| Modifier and Type | Annotation and Description |
|---|---|
| public @interface | WithAnnotations
|
| Modifier and Type | Class and Description |
|---|---|
| public abstract class | |
| public class | DefinitionException
Thrown when a definition error occurs. |
| public class | DeploymentException
Thrown when a deployment problem occurs. |
| public class | Unmanaged<
type of unmanaged instances T>Helper class for injecting and calling lifecycle callbacks unmanaged instances for use by framework and library integrators. |
| Modifier and Type | Enum and Description |
|---|---|
| public enum | InterceptionType
Identifies the kind of lifecycle callback, EJB timeout method or business method interception. |
| public enum | SessionBeanType
Identifies the kind of EJB session bean. |