Struts2与Spring结合的jar包

Struts2与Spring结合使用,让Spring来管理Action实例,引入struts2-spring-plugin-x.x.x.x.jar。

既然要用Spring来管理Action实例那是不是要在web.xml中加上下面的配置呢:

<constant name="struts.objectFactory" value="spring" />

今天发现其实这句都不用加,在struts2-spring-plugin-x.x.x.x.jar包里的struts-plugin.xml文件里发现如下配置:

<bean type="com.opensymphony.xwork2.ObjectFactory" name="spring" class="org.apache.struts2.spring.StrutsSpringObjectFactory" />

<!--  Make the Spring object factory the automatic default -->
<constant name="struts.objectFactory" value="spring" />


猜你喜欢

转载自blog.csdn.net/zhang854429783/article/details/12222075