marți, 3 februarie 2015

[OmniFaces utilities (2.0)] Get the CDI managed bean reference (proxy) of the given bean representation


[OmniFaces utilities] The getReference() method returns the CDI managed bean reference (proxy) of the given bean representation.Note that this actually returns a client proxy and the underlying actual instance is thus always auto-created.

Method:
Usage:

import org.omnifaces.util.Beans;
import javax.enterprise.inject.spi.Bean;
...
// in/out CDI bean TestBean
Bean<TestBean> testBeanRep = Beans.resolve(TestBean.class);
TestBean testBeanRef = Beans.getReference(testBeanRep);

Niciun comentariu:

Trimiteți un comentariu