I have following situation:
- I use Struts2 as MVC cobtroller
- I use Spring as object factory
- I im开发者_JAVA百科plemented custom action mapper, I have configured this as a bean in my spring configuration.
How can I tell Struts to use this bean as an action mapper?
I tried top set:
struts.mapper.class=beanName
in struts.properties
but this doesn't work.
Do you have have following the struts.xml file ? This is required to tell Struts2 that objects will be created by Spring
<struts>
<constant name="struts.objectFactory" value="org.apache.struts2.spring.StrutsSpringObjectFactory" />
...
</struts>
OR
Add the following property in the struts.properties
struts.objectFactory = org.apache.struts2.spring.StrutsSpringObjectFactory
精彩评论