Struts2 与 Spring 结合,使用 Spring 来管理 Action 实例,在项目中引入了struts2-spring-plugin-2.2.1.jar 包。然后想到的是既然是要用 Spring 来管理 Action 实例,就得在 struts.xml 里加上:
1 |
<constant name="struts.objectFactory" value="spring" /> |
或者是在 struts.properties 里加上一条属性:
1 |
struts.objectFactory = spring |
OK,这也没问题,然而有次在某个测试项目中想暂时不用 Spring 来管理 Bean,于是把上面的配置去了,也把 web.xml 中的相关 Spring 的 ContextLoaderListener 也格啦。容器启动的时候却发现: 阅读全文 >>