Module jakarta.cdi

Interface BeanManager

All Superinterfaces:
BeanContainer

public interface BeanManager extends BeanContainer

Allows a portable extension to interact directly with the container. Provides operations for obtaining contextual references for beans, along with many other operations of use to portable extensions.

In CDI Lite environment, applications may obtain a BeanManager, but invoking methods that are not inherited from BeanContainer results in non-portable behavior.

Any bean may obtain an instance of BeanManager by injecting it:

 @Inject
 BeanManager manager;
 

Java EE components may obtain an instance of BeanManager from JNDI by looking up the name java:comp/BeanManager.

Most operations of BeanManager may be called at any time during the execution of the application.

However, the following operations must not be called before the AfterBeanDiscovery event is fired:

and the following operations must not be called before the AfterDeploymentValidation event is fired:

or the container will throw an Exception.