Top Description Interfaces Annotations Classes Enums
[default module]

Package javax.enterprise.inject.spi


The portable extension integration SPI.

A portable extension may integrate with the container by:

The BeanManager object

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.

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 javax.enterprise.inject.spi.BeforeBeanDiscovery, javax.enterprise.inject.spi.AfterBeanDiscovery, javax.enterprise.inject.spi.AfterDeploymentValidation and javax.enterprise.inject.spi.BeforeShutdown.

Interfaces representing enabled beans

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.

Alternate metadata sources

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.

Producer and InjectionTarget

The interfaces 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.

See Also
javax.enterprise.inject, javax.enterprise.context.spi

Interface Summary

Modifier and TypeInterface 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 javax.enterprise.inject.spi.Bean and javax.enterprise.inject.spi.ObserverMethod objects for the discovered beans, but before detecting deployment problems.

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
AnnotatedCallable<
the declaring type
X
>

Represents a callable member of a Java type.

public interface
AnnotatedConstructor<
the declaring class
X
>

Represents a constructor of a Java class.

public interface
AnnotatedField<
the declaring type
X
>

Represents a field of a Java class.

public interface
AnnotatedMember<
the declaring type
X
>

Represents a member of a Java type.

public interface
AnnotatedMethod<
the declaring type
X
>

Represents a method of a Java type.

public interface
AnnotatedParameter<
the type that declares the method or constructor
X
>

Represents a parameter of a method or constructor.

public interface
AnnotatedType<
the type
X
>

Represents a Java class or interface.

public interface
Bean<
the class of the bean instance
T
>

Represents an enabled bean.

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
Decorator<
the decorator bean class
T
>

Represents an enabled decorator.

public interface
EventContext<
type of event object
T
>

Represents a context of a fired event.

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 InjectionTargetFactory can create an InjectionTarget for a given bean.

public interface
InterceptionFactory<
type for which the wrapper is created
T
>

InterceptionFactory allows to create a wrapper instance whose method invocations are intercepted by method interceptors and forwarded to a provided instance.

public interface
Interceptor<
the interceptor bean class
T
>

Represents an enabled interceptor.

public interface
ObserverMethod<
the event type
T
>

Represents an observer method of an enabled bean.

public interface
PassivationCapable

Indicates that a custom implementation of javax.enterprise.inject.spi.Bean or javax.enterprise.context.spi.Contextual is passivation capable.

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 javax.enterprise.inject.spi.Bean object.

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 javax.enterprise.inject.spi.Bean object.

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 javax.annotation.ManagedBean, EJB session or message-driven bean, enabled bean, enabled interceptor or enabled decorator.

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 javax.annotation.ManagedBean, EJB session or message-driven bean, enabled bean, enabled interceptor or enabled decorator.

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 javax.enterprise.inject.spi.Bean object.

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 javax.enterprise.inject.spi.ObserverMethod object.

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 javax.enterprise.inject.spi.Bean object.

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 javax.enterprise.inject.spi.Bean object.

public interface
ProcessSessionBean<X>

The container fires an event of this type for each enabled session bean, before registering the javax.enterprise.inject.spi.Bean object.

public interface
ProcessSyntheticAnnotatedType<
The class being annotated
X
>

The container fires an event of this type for each Java class or interface added by BeforeBeanDiscovery#addAnnotatedType(AnnotatedType), BeforeBeanDiscovery#addAnnotatedType(AnnotatedType, String) or javax.enterprise.inject.spi.AfterTypeDiscovery#addAnnotatedType(AnnotatedType, String)

Any observer of this event is permitted to wrap and/or replace the javax.enterprise.inject.spi.AnnotatedType.

public interface
ProcessSyntheticBean<
The class of the bean
X
>

The container fires an event of this type for each custom bean implementation added through AfterBeanDiscovery#addBean() or AfterBeanDiscovery#addBean(Bean), before registering the javax.enterprise.inject.spi.Bean object.

public interface
ProcessSyntheticObserverMethod<
The type of the event being observed
T
,
The bean type containing the observer method, i.e. ObserverMethod#getBeanClass()
X
>

The container fires an event of this type for each custom implementation of ObserverMethod added through AfterBeanDiscovery#addObserverMethod(ObserverMethod) or AfterBeanDiscovery#addObserverMethod(), before registering the javax.enterprise.inject.spi.ObserverMethod object.

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 ProducerFactory can create an Producer for a given bean.

Annotation Summary

Modifier and TypeAnnotation and Description
public @interface
WithAnnotations

WithAnnotations may be applied to any portable extension observer method with an event parameter type of ProcessAnnotatedType to filter the events delivered.

Class Summary

Modifier and TypeClass and Description
public abstract class
CDI<
type inherited from Instance. Always Object for CDI
T
>

Provides access to the current container.

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.

Enum Summary

Modifier and TypeEnum 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.