luni, 2 februarie 2015

[OmniFaces utilities (2.0)] Get the CDI bean manager


[OmniFaces utilities] The getManager() method returns the CDI bean manager.

Method:
org.omnifaces.config.BeanManager is an OmniFaces enum that allows you to get a reference to CDI managed beans without having any direct CDI dependency. It will during initialization grab the CDI bean manager instance from JNDI and if it's not null, then  it's using reflection to get and store the necessary methods in the enum instance which are then invoked on instance methods such as getReference(). - source: OmniFaces

Usage:

import org.omnifaces.util.Beans;
import javax.enterprise.inject.spi.BeanManager;
...
BeanManager beanManager = Beans.getManager();

Niciun comentariu:

Trimiteți un comentariu