测试版本:Struts2.3.4 、Spring3.2
1、确保你的struts2-spring插件jar包已经添加
2、将如下代码复制到web.xml中
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/classes/beans.xml</param-value> <!-- 此处存放spring的配置文件-->
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
3、在struts.xml中指定objectFactory
<constant name="struts.objectFactory" value="org.apache.struts2.spring.StrutsSpringObjectFactory" />