`
zyshaw
  • 浏览: 53126 次
  • 性别: Icon_minigender_1
  • 来自: 加興
文章分类
社区版块
存档分类
最新评论

spring整合struts2配置

 
阅读更多
web.xml中配置spring配置文件的地址和context启动类

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/**/spring*.xml</param-value>

  </context-param>
 
  <listener>
  <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  </listener>

然后在spring*.xml文件中配置bean管理

这里bean用自动扫描的方式配置
<!-- 自动扫描bean -->
<context:component-scan base-package="com.huawei"
use-default-filters="false">
<context:include-filter type="regex"
expression="com.huawei.struts.*Action" />
<!-- 
<context:include-filter type="regex"
expression="com.huawei.service.impl.*ServiceImpl" />-->
</context:component-scan>
在struts的action的配置中class改为spring 管理bean的引用就可以了
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics