1.ApplicationContext context = new ClassPathXmlApplicationContext("beans-config.xml");
2.ApplicationContext context = new ClassPathXmlApplicationContext(
new String[] {"beans-config.xml","beans-config2.xml"} );
3.ApplicationContext context = new ClassPathXmlApplicationContext("classpath*:beans-config.xml");
4.ApplicationContext context = new ClassPathXmlApplicationContext("beans*.xml");
本文介绍了使用Spring框架时,通过不同方式加载配置文件的具体方法。包括单个配置文件的加载、多个配置文件的同时加载、使用通配符加载一组配置文件等。这对于理解和实践Spring的应用程序上下文初始化非常有用。
1001

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



