spring多配置文件的加载方式

一、多配置文件的加载方式

在src的目录下多创建一个配置文件,现在我们有两个核心的配置文件,同时加载这两种配置文件的方法有两种

1、主配置文件中包含其他配置文件方法:

<import resource="applicationContext2.xml"/>

2、工厂创建的时候直接加载多个配置文件:


ApplicationContext ac=new ClassPathXmlApplicationContext("applicationContext.xml","applicationContext2.xml");

猜你喜欢

转载自blog.csdn.net/weixin_44001568/article/details/105790183