struts2与spring框架整合

来源:互联网 发布:怎么做好淘宝手机端 编辑:程序博客网 时间:2024/06/06 03:10

struts2与spring整合的一种常用的方法

这种方法在开发中常用到,就是spring来管理action。在struts2框架中所有的interceptor,action,result都是bean,它们的创建是由struts-default.xml配置文件中的ObjectFactory创建的,当在进行struts2和spring整合的时候要导入一个重要的jar包,struts2-spring-plugin.jar,就会加载这个包下的struts-plugin.xml,这时bean的创建就由StrutsSpringObjectFactory来管理。此时在struts.xml配置文件中action路径需要写在applicationContext.xml文件中配置的action的名称。(我的微博用于朋友共享学习不喜勿喷)

原创粉丝点击