江西广告网

标题: spring中如何加载多个配置文件 [打印本页]

作者: 怨女    时间: 2009-1-11 10:31
标题: spring中如何加载多个配置文件
1.第一种,使用数组 代码 ApplicationContext contex=new ClassXmlApplicationContext(bew String["a1.xml","a2.xml"]); 2.第二种,只用通配符 代码 ApplicationContext contex=new ClassXmlApplicationContext("a*.xml"); //但此种方法只对文件系统中的xml文件有效,针对jar包中的无效 3.第三种,引入 代码 ApplicationContext contex=new ClassXmlApplicationContext("a1.xml"); //在a1.xml中 //执行resource路径为相对a1.xml的路径




欢迎光临 江西广告网 (http://bbs.jxadw.com/) Powered by Discuz! X3.2