当我在tomcat上运行我的应用程序时,spring-context.xml文件位于
/WEB-inf/spring-context.xml
还行吧.但运行junit测试我必须提供我的spring-test-context.xml的位置,如下所示:
@ContextConfiguration(locations={"classpath:/spring-test-context.xml"})
Run Code Online (Sandbox Code Playgroud)
这种方法的唯一方法是文件位于
/src/spring-context.xml
如何让我的应用程序在同一位置找到我的spring-context文件?那么它适用于junit睾丸并部署在tomcat上?
我尝试了这个,它给了我很多关于没有找到任何豆子的错误,但它没有说它找不到文件..
classpath:/WEB-INF/spring-test-context.xml
Run Code Online (Sandbox Code Playgroud)