Spring中的多配置文件原来如此简单

一直都在找spring如何指定多个配置文件,因为一个系统一旦比较大以后所有的配置都放在一个文件中是非常不好的,不光是维护的问题,多人开发出现冲突
的可能性也就很大了,一直在搜索,但是没有什么结果,结果今天看了spring的参考手册(中文的那个1.1PR版)才发现非常的简单,在web.xml
中配置的时候直接指定多个文件就可以了,用空格、逗号或者分号分隔都可以,例如:
   <listener>
     
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
   </listener>
   <context-param>
      <param-name>contextConfigLocation</param-name>
     
<param-value>/WEB-INF/configs/spring-config.xml
/WEB-INF/configs/db-config.xml</param-value>
   </context-param>


作者: Cherami
原载: Spring中的多配置文件原来如此简单
版权所有。转载时必须以链接形式注明作者和原始出处及本声明。

日志评价

 Votes | Average: 0 out of 5 Votes | Average: 0 out of 5 Votes | Average: 0 out of 5 Votes | Average: 0 out of 5 Votes | Average: 0 out of 5 (暂无评价) --点击星星直接投票
Loading ... Loading ...


相关日志



随机日志



添加到网摘

[del.icio.us]  [新浪 VIVI]  [365key]  [YouNote]  [博采中心]  [Poco]  [SOHU狐摘]  [天极网摘]  [和讯网摘]
喜欢这个插件?

当前日志信息