首页 > 移动平台 > 详细

SSM单元测试时出现:Failed to load ApplicationContext的一种可能解决办法

时间:2019-04-27 21:42:28      阅读:292      评论:0      收藏:0      [点我收藏+]

SSM单元测试时出现:

严重: Caught exception while allowing TestExecutionListener [org.springframework.test.context.support.DependencyInjectionTestExecutionListener@402bba4f] to prepare test instance ………………

网上有很多相关错误的解决办法,但是没有我想要的,真是cd!!!

然后看控制台的输出好像有这么一句提示:type filter class: java.lang.ClassNotFoundException: org.springframework.stereotype.Contorller

回到spring的配置文件,发现下面几行的前面有个黄色的感叹号,定眼一瞧,握草,这句waring很眼熟:Ignoring non-present type filter class: java.lang.ClassNotFoundException: org.springframework.stereotype.Contorller

<context:component-scan
        base-package="com.example">
        <context:exclude-filter type="annotation"
            expression="org.springframework.stereotype.Controller" />
    </context:component-scan>

 

一时半会也不知道怎么搞它,最后我将上面的那段复制后删去,再粘贴回去,warning没了,单元测试也通过了,邪门了!!!

记录一下,如果有类似的错误的,先看控制台的提示信息吧!

SSM单元测试时出现:Failed to load ApplicationContext的一种可能解决办法

原文:https://www.cnblogs.com/Guhongying/p/10780199.html

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