可以的,偶的上个项目就是分模块配置spring文件,这样非常便于维护.(偶的项目架构是struts+spring+hibernate)
具体配置如下:
有三模块:A,B,C分别对应三个spring文件spring-a.xml,spring-b.xml,spring-c.xml还有数据源的applicationContext.xml文件.
其中applicationContext.xml在web.xml中配置:
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/applicationContext.xml,
</param-value>
</context-param>
spring-a.xml,spring-b.xml,spring-c.xml在struts-config.xml中配置:
<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
<set-property property="contextConfigLocation"
value="spring-a.xml,
spring-b.xml,
spring-c.xml "
/>
</plug-in>
具体配置如下:
有三模块:A,B,C分别对应三个spring文件spring-a.xml,spring-b.xml,spring-c.xml还有数据源的applicationContext.xml文件.
其中applicationContext.xml在web.xml中配置:
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/applicationContext.xml,
</param-value>
</context-param>
spring-a.xml,spring-b.xml,spring-c.xml在struts-config.xml中配置:
<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
<set-property property="contextConfigLocation"
value="spring-a.xml,
spring-b.xml,
spring-c.xml "
/>
</plug-in>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货