1. 程式人生 > >SSM單元測試時出現:Failed to load ApplicationContext的一種可能解決辦法

SSM單元測試時出現:Failed to load ApplicationContext的一種可能解決辦法

allow .class 網上 sent contex font enc example clu

SSM單元測試時出現:

嚴重: Caught exception while allowing TestExecutionListener [org.springframewor[email protected]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的一種可能解決辦法