1、在src下(class):
ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");//spring 上下文
2、在/WebRoot/WEB-INF/下(带路径的)
ApplicationContext ctx = new FileSystemXmlApplicationContext("/WebRoot/WEB-INF/applicationContext.xml");//spring 上下文
本文介绍了两种Spring上下文的加载方式:一种是在src目录下的class路径中加载applicationContext.xml文件;另一种是在/WebRoot/WEB-INF/目录下通过指定路径加载applicationContext.xml文件。
9680

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



