方法一:在类路径下寻找配置来实例化容器
1 applicationContext ctx = new ClassPathxmlApplicationContext( 2 new String[]{"beans.xml"});
方法二:在文件系统路径下寻找配置文件来实例化容器
1 ApplicationContext ctx = new FileSystemXmlApplicationContext( 2 new String[]{"d://beans.xml"});
Spring的配置文件可以指定多个,通过string数组传入
新闻热点
疑难解答