首先在web.xml中加载spring监听器;
struts.xml
配置action;
applicationcontext.xml中配置bean
dao,service,class都为接口实现(impl)
dao属性注入service
dao作用域设为singleton
action
service作用域设为prototype;
service属性注入action
其次在Myeclipse中加载struts2-spring-plugin-2.2.1.1包;
bean中只要set就可以调用了。
本文介绍如何在Struts2框架中整合Spring框架,包括配置web.xml、struts.xml和applicationContext.xml文件,实现DAO、Service及Action的正确配置与注入。同时,指导如何设置不同组件的作用域。
1万+

被折叠的 条评论
为什么被折叠?



