我有一个基于maven的Spring 3.0项目。 Web应用程序的Spring配置文件位于/<proj>/src/main/webapp/WEB-INF/spring/webmvc-config.xml
。
现在我想要一个JUnit测试来检查是否可以启动上下文。但我没有知道如何以maven正确的方式在@ContextConfiguration
标签中指定该文件的位置。
我在做:
@RunWith(SpringJUnit4ClassRunner.class)
@Transactional()
@ContextConfiguration({
"classpath:META-INF/spring/application-context.xml",
"file:src/main/webapp/WEB-INF/spring/webmvc-config.xml",
})
public class SpringMvcContextTest {
但我很确定我不应该引用maven src
目录。
答案 0 :(得分:4)
如果您在maven
,为什么不为此选择resource
目录,并使用classpah:file.xml