多个 spring的配置文件加载
2008-03-12 15:45
363 查看
在多个人做同一个项目的时候肯定需要使用多个struts_config.xml文件和多个applicationContext.xml文件。那么怎么配置这些文件呢?
首先配置多个struts_congfig.xml文件。。 在web.xml中写下面的代码:
config
/WEB-INF/struts-config.xml,/WEB-INF/struts-config_mhb.xml,/WEB-INF/struts-config_zzg.xml,/WEB-INF/struts-config_lf.xml,/WEB-INF/struts-config_sx.xml
(前提是保证这几个文件的存在。)
这样多个struts_config.xml的配置文件就完了。。
继续配置多个applicationContext.xml文件。这个是在struts_config.xml文件下完成的:
className="org.springframework.web.struts.ContextLoaderPlugIn">
value="/WEB-INF/classes/applicationContext.xml,/WEB-INF/classes/applicationContext_zzg.xml,/WEB-INF/classes/applicationContext_mhb.xml" />
(也是要保证文件的存在)
这样就配置完了。 有的人配置多个applicationContext.xml文件也在XML下配置。配置代码如下:
contextConfigLocation
classpath:/applicationContext*.xml
(这种方式的配置是所有applicationContext.xml文件都在classes下)。
首先配置多个struts_congfig.xml文件。。 在web.xml中写下面的代码:
config
/WEB-INF/struts-config.xml,/WEB-INF/struts-config_mhb.xml,/WEB-INF/struts-config_zzg.xml,/WEB-INF/struts-config_lf.xml,/WEB-INF/struts-config_sx.xml
(前提是保证这几个文件的存在。)
这样多个struts_config.xml的配置文件就完了。。
继续配置多个applicationContext.xml文件。这个是在struts_config.xml文件下完成的:
className="org.springframework.web.struts.ContextLoaderPlugIn">
value="/WEB-INF/classes/applicationContext.xml,/WEB-INF/classes/applicationContext_zzg.xml,/WEB-INF/classes/applicationContext_mhb.xml" />
(也是要保证文件的存在)
这样就配置完了。 有的人配置多个applicationContext.xml文件也在XML下配置。配置代码如下:
contextConfigLocation
classpath:/applicationContext*.xml
(这种方式的配置是所有applicationContext.xml文件都在classes下)。
相关文章推荐
- Spring学习总结(20)——Spring加载多个项目properties配置文件问题解决
- Spring学习总结(20)——Spring加载多个项目properties配置文件问题解决
- spring 加载配置文件application.properties,类里如何调用@Value的解决办法
- is not mapped问题,Spring加载jar中配置文件
- spring 和springmav 加载配置文件的方式
- spring加载配置文件
- Spring中使用classpath加载配置文件浅析
- Spring 配置文件xxxx.xml文件中scheme约束exlipse自动加载不了的解决
- Spring中加载XML配置文件的6种方式
- Spring:加载xml配置文件
- 参数配置文件properties--使用spring加载和简化读取
- Spring的 classpath 通配符加载配置文件
- spring (三) 加载外部资源文件/配置jdbc数据源
- 可以从Jar外部加载JDBC.properties的Spring-mybatis配置文件
- spring的配置文件在web.xml中加载的方式
- Spring的 classpath 通配符加载配置文件
- Spring Boot加载配置文件
- Spring加载xml配置文件的方式 ApplicationContext
- Spring 创建 IOC 容器时加载配置文件的几种方式
- 【Spring】Spring的IOC(控制反转)/DI(依赖注入)原理(二):模拟Spring加载配置文件