在使用spring中的ContextConfiguration、test注解时出现的错误

错误:

  在使用测试注解时出现ContextConfiguration注解和test注解无法正常导包使用的编译异常,如图:

解决办法:

  将pom.xml文件中以下依赖管理

  中的<scope>test</scope>一行删除

原因:

  不熟悉maven文件结构所致,maven在编译运行的时候src/main/java文件中是不会引用<scope>test</scope>的jar,也就是说在写测试类的时候最好是写在src/test/java文件中!

posted on 2019-12-02 17:15  啊哈那个苏  阅读(844)  评论(0)    收藏  举报

导航