测试环境:Spring3.0.5 + Junit4.8.1
?
配置文件放在class目录下:
ApplicationContext applicationContext = new ClassPathXmlApplicationContext("spring.xml");
?WEB-INF下:
ApplicationContext applicationContext = new FileSystemXmlApplicationContext("WebRoot/WEB-INF/spring.xml");
?
注解方式:
class:
@ContextConfiguration(locations={"classpath:spring.xml"})
?WEB-INF:
@ContextConfiguration(locations={"file:WebRoot/WEB-INF/spring.xml"})?