@ContextConfiguration 此注解无法取到application位置

来源:互联网 发布:网络说凸是什么意思 编辑:程序博客网 时间:2024/05/22 14:44
J2EE开发时applicationContext在WebContent/WEB-INF/中
@ContextConfiguration(locations={"classpath:applicationContext.xml"}) 此注解无法取到
两种解决办法
1、用文件注解的形式@ContextConfiguration(locations="file:WebContent/WEB-INF/applicationContext.xml")
2、在eclipse的.classpath 文件中加入<classpathentry kind="src" path="WebContent/WEB-INF">
@ContextConfiguration Spring整合JUnit4测试时,使用注解引入多个配置文件单个文件 @ContextConfiguration(Locations="../applicationContext.xml")  @ContextConfiguration(classes = SimpleConfiguration.class)多个文件时,可用{}@ContextConfiguration(locations = { "classpath*:/spring1.xml", "classpath*:/spring2.xml" }) 
0 0