Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/308.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何在spring JUnit测试中正确配置WEB-INF/spring/webmvc-config.xml_Java_Spring_Testing_Maven - Fatal编程技术网

Java 如何在spring JUnit测试中正确配置WEB-INF/spring/webmvc-config.xml

Java 如何在spring JUnit测试中正确配置WEB-INF/spring/webmvc-config.xml,java,spring,testing,maven,Java,Spring,Testing,Maven,我有一个基于maven的Spring3.0项目。web应用程序的Spring配置文件位于//src/main/webapp/web-INF/Spring/webmvc config.xml 现在我想做一个JUnit测试,检查上下文是否可以启动。但是我不知道如何以一种maven正确的方式在@ContextConfiguration标记中指定该文件的位置 我正在做: @RunWith(SpringJUnit4ClassRunner.class) @Transactional() @ContextCo

我有一个基于maven的Spring3.0项目。web应用程序的Spring配置文件位于
//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
目录。

如果您在
maven
上,为什么不为此选择
resource
目录,并使用
classpah:file.xml