首页 > 编程语言 > 详细

今天在测试spring和mybatis的时候,报了找不到配置文件

时间:2019-09-09 17:33:00      阅读:178      评论:0      收藏:0      [点我收藏+]
java.lang.IllegalStateException: Failed to load ApplicationContext
Caused by: java.lang.IllegalArgumentException: Cannot load an ApplicationContext with a NULL ‘contextLoader‘. Consider annotating your test class with @ContextConfiguration or @ContextHierarchy.

以上是报错信息,后来发现。

这两句话需要加在测试类上面。

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

以上适用于新手

今天在测试spring和mybatis的时候,报了找不到配置文件

原文:https://www.cnblogs.com/yingwangwang/p/11492582.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!