09-Spring分模块开发的配置

方式一:在加载配置文件的时候,加载多个

//  1、创建Spring的工厂
ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext-1.xml","applicationContext-2.xml");

方式二:在一个配置文件中引入多个配置文件 

在applicationContext.xml这个配置文件中引入其他配置文件

<import resource="applicationContext-1.xml"/>
<import resource="applicationContext-2.xml"/>

这样只需加载applicationContext.xml这个配置文件即可 

猜你喜欢

转载自blog.csdn.net/zhuzbYR/article/details/100839631
今日推荐