[OmniFaces utilities] The
getInstance()
returns the CDI managed bean instance (actual) of the given bean representation and creates one if one doesn't exist and create
argument is true
, otherwise don't create one and return null
if there's no current instance.Method:
import
org.omnifaces.util.Beans;
import
javax.enterprise.inject.spi.Bean;
...
// in/out
CDI bean TestBean
// if the
second parameter is false and there's no current instance, then it will return
null
Bean<TestBean>
testBeanRep = Beans.resolve(TestBean.class);
TestBean
testBean = Beans.getInstance(testBeanRep, true);
Niciun comentariu :
Trimiteți un comentariu