Maven项目中引入spring-test单元测试 @RunWith与@ContextConfigration报错

场景

在SSM项目整合时引入spring-test单元测试时,

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations={"classpath:applicationContext.xml"})

报错。

pom.xml中引入依赖如下

此依赖是从Maven中央仓库直接复制过来的

解决

将pom.xml中的spring-test的依赖中的<scope>去掉

猜你喜欢

转载自blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/85220669
今日推荐