ApplicationContext context = new ClassPathXmlApplicationContext("service.xml");
if (ac.containsBean("swmsBussinessCodeManager")) {
BussinessCodeManager codeManager = (BussinessCodeManager)ac.getBean("swmsBussinessCodeManager");
}
如果是两个以上:
ApplicationContext ac = new ClassPathXmlApplicationContext(new String[]{"applicationContext.xml","dao.xml"});
或者用通配符:
ApplicationContext ac = new ClassPathXmlApplicationContext("classpath:/*.xml");
本文介绍了如何使用Spring框架加载多个XML配置文件的方法。包括通过指定多个文件路径、使用通配符匹配多个文件等技巧,为应用程序提供灵活的配置管理。

942

被折叠的 条评论
为什么被折叠?



