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 Bean
and ObserverMethod
objects for the discovered beans, but before detecting deployment
problems.
A portable extension may take advantage of this event to register beans, interceptors, decorators, observer methods and custom context objects with the container.
void afterBeanDiscovery(@Observes AfterBeanDiscovery event, BeanManager manager) { ... }
If any observer method of the AfterBeanDiscovery
event throws an exception, the exception is treated as a definition
error by the container.
Modifier and Type | Method and Description |
---|---|
<T> BeanConfigurator<T> |
addBean()
Obtains a new
BeanConfigurator to configure a new Bean and add it at the end of the observer invocation. |
void |
addBean(Bean<?> bean)
Fires an event of type
ProcessBean containing the given
Bean and then registers the Bean with the
container, thereby making a bean which is not an interceptor nor a decorator available for injection into other beans. |
void |
addContext(Context context)
Registers a custom
Context object with the container. |
void |
addDefinitionError(java.lang.Throwable t)
Registers a definition error with the container, causing the container to abort deployment after all observers have been
notified.
|
<T> ObserverMethodConfigurator<T> |
addObserverMethod()
obtains a new
ObserverMethodConfigurator to configure a new ObserverMethod and add it at the end of the observer invocation. |
void |
addObserverMethod(ObserverMethod<?> observerMethod)
Fires an event of type
ProcessObserverMethod containing the given
ObserverMethod and then registers the
ObserverMethod with the container, thereby making it available for event
notifications. |
<T> AnnotatedType<T> |
getAnnotatedType(java.lang.Class<T> type,
java.lang.String id)
Obtain the
AnnotatedType that may be used to read the annotations of the given class or interface as defined
during container initialization. |
<T> java.lang.Iterable<AnnotatedType<T>> |
getAnnotatedTypes(java.lang.Class<T> type)
Obtain the
AnnotatedType s that may be used to read the annotations of the given class or interface as defined
during container initialization. |
void addDefinitionError(java.lang.Throwable t)
t
- The definition error as a Throwable
java.lang.IllegalStateException
- if called outside of the observer method invocationvoid addBean(Bean<?> bean)
ProcessBean
containing the given
Bean
and then registers the Bean
with the
container, thereby making a bean which is not an interceptor nor a decorator available for injection into other beans.
The given Bean
may implement Interceptor
or Decorator
.bean
- The bean to add to the deploymentjava.lang.IllegalStateException
- if called outside of the observer method invocation<T> BeanConfigurator<T> addBean()
BeanConfigurator
to configure a new Bean
and add it at the end of the observer invocation.
It will then fire an event of type ProcessBean
containing the built
Bean
from this configuration and then register it with the
container, thereby making it available for injection into other beans.
Each call returns a new BeanConfigurator.BeanConfigurator
to configure the bean to addjava.lang.IllegalStateException
- if called outside of the observer method invocationvoid addObserverMethod(ObserverMethod<?> observerMethod)
ProcessObserverMethod
containing the given
ObserverMethod
and then registers the
ObserverMethod
with the container, thereby making it available for event
notifications.observerMethod
- The custom observer method to add to the deploymentjava.lang.IllegalStateException
- if called outside of the observer method invocation<T> ObserverMethodConfigurator<T> addObserverMethod()
ObserverMethodConfigurator
to configure a new ObserverMethod
and add it at the end of the observer invocation.
It will then fire an event of type ProcessObserverMethod
containing the built
ObserverMethod
from this configuration and then registers the
ObserverMethod
with the container, thereby making it available for event
notifications.
Each call returns a new ObserverMethodConfigurator.ObserverMethodConfigurator
instancejava.lang.IllegalStateException
- if called outside of the observer method invocationvoid addContext(Context context)
Context
object with the container.context
- The custom context to add to the deploymentjava.lang.IllegalStateException
- if called outside of the observer method invocation<T> AnnotatedType<T> getAnnotatedType(java.lang.Class<T> type, java.lang.String id)
AnnotatedType
that may be used to read the annotations of the given class or interface as defined
during container initialization.T
- the class or interfacetype
- the Class
objectid
- the type identifier. If null, the fully qualifier class name of type is usedAnnotatedType
java.lang.IllegalStateException
- if called outside of the observer method invocation<T> java.lang.Iterable<AnnotatedType<T>> getAnnotatedTypes(java.lang.Class<T> type)
AnnotatedType
s that may be used to read the annotations of the given class or interface as defined
during container initialization.T
- the class or interfacetype
- the Class
objectAnnotatedType
sjava.lang.IllegalStateException
- if called outside of the observer method invocation