|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.opensymphony.xwork2.ObjectFactory
org.apache.struts2.cdi.CdiObjectFactory
public class CdiObjectFactory
CdiObjectFactory allows Struts 2 managed objects, like Actions, Interceptors or Results, to be injected by a Contexts and Dependency Injection container (JSR299 / WebBeans). The BeanManager instance will be searched in the container's JNDI context, according to following algorithm:
struts.objectFactory.cdi.jndiKey
is given, this key will be looked upCDI_JNDIKEY_BEANMANAGER_COMP
CDI_JNDIKEY_BEANMANAGER_APP
CDI_JNDIKEY_BEANMANAGER_COMP_ENV
Field Summary | |
---|---|
protected javax.enterprise.inject.spi.BeanManager |
beanManager
|
static String |
CDI_JNDIKEY_BEANMANAGER_APP
The key under which the BeanManager can be found according to JBoss Weld docs |
static String |
CDI_JNDIKEY_BEANMANAGER_COMP
The key under which the BeanManager can be found according to CDI API docs |
static String |
CDI_JNDIKEY_BEANMANAGER_COMP_ENV
The key under which the BeanManager can be found in pure Servlet containers according to JBoss Weld docs. |
Constructor Summary | |
---|---|
CdiObjectFactory()
|
Method Summary | |
---|---|
Object |
buildBean(String className,
Map<String,Object> extraContext,
boolean injectInternal)
|
protected javax.enterprise.context.spi.CreationalContext |
buildNonContextualCreationalContext(javax.enterprise.inject.spi.BeanManager beanManager)
Simple wrapper for CreationalContext creation. |
protected javax.enterprise.inject.spi.BeanManager |
findBeanManager()
Try to find the CDI BeanManager from JNDI context. |
protected javax.enterprise.inject.spi.InjectionTarget<?> |
getInjectionTarget(Class<?> clazz)
Get a InjectionTarget instance for a given class. |
boolean |
isNoArgConstructorRequired()
Allow constructor injection |
protected javax.enterprise.inject.spi.BeanManager |
lookup(Context context,
String jndiKeyToCheck)
Lookup the given JNDI key in the given context. |
void |
setJndiKey(String jndiKey)
|
Methods inherited from class com.opensymphony.xwork2.ObjectFactory |
---|
buildAction, buildBean, buildBean, buildConverter, buildInterceptor, buildResult, buildUnknownHandler, buildValidator, getClassInstance, getObjectFactory, injectInternalBeans, setActionFactory, setClassLoader, setContainer, setConverterFactory, setInterceptorFactory, setResultFactory, setUnknownHandlerFactory, setValidatorFactory |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String CDI_JNDIKEY_BEANMANAGER_COMP
public static final String CDI_JNDIKEY_BEANMANAGER_APP
public static final String CDI_JNDIKEY_BEANMANAGER_COMP_ENV
protected javax.enterprise.inject.spi.BeanManager beanManager
Constructor Detail |
---|
public CdiObjectFactory()
Method Detail |
---|
public void setJndiKey(String jndiKey)
protected javax.enterprise.inject.spi.BeanManager findBeanManager()
CDI_JNDIKEY_BEANMANAGER_COMP
will be tested. If nothing is found there, the key CDI_JNDIKEY_BEANMANAGER_APP
will be checked. If still nothing is found there, the key CDI_JNDIKEY_BEANMANAGER_COMP_ENV
will be checked.
protected javax.enterprise.inject.spi.BeanManager lookup(Context context, String jndiKeyToCheck)
context
- the context to use for lookup.jndiKeyToCheck
- the key to lookup.
NamingException
was thrown.public Object buildBean(String className, Map<String,Object> extraContext, boolean injectInternal) throws Exception
buildBean
in class com.opensymphony.xwork2.ObjectFactory
Exception
protected javax.enterprise.inject.spi.InjectionTarget<?> getInjectionTarget(Class<?> clazz)
clazz
- The class to get a InjectionTarget instance for.
protected javax.enterprise.context.spi.CreationalContext buildNonContextualCreationalContext(javax.enterprise.inject.spi.BeanManager beanManager)
beanManager
- the BeanManager to use for creating the context.
public boolean isNoArgConstructorRequired()
isNoArgConstructorRequired
in class com.opensymphony.xwork2.ObjectFactory
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |