This class provides access to the {@link BeanManager}by registering the current {@link BeanManager} in an extension andmaking it available via a singleton factory for the current application.
This is really handy if you like to access CDI functionality from places where no injection is available.
If a simple but manual bean-lookup is needed, it's easier to use the {@link BeanProvider}.
As soon as an application shuts down, the reference to the {@link BeanManager} will be removed.
Usage:
BeanManager bm = BeanManagerProvider.getInstance().getBeanManager();
Attention: This method is intended for being used in user code at runtime. If this method gets used during Container boot (in an Extension), non-portable behaviour results. During bootstrapping an Extension shall @Inject BeanManager to get access to the underlying BeanManager (see e.g. {@link #cleanupFinalBeanManagers} ).This is the only way to guarantee to get the right BeanManager in more complex Container scenarios.
|
|
|
|