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沒了,單元測試也通過了,邪門了!!!
記錄一下,如果有類似的錯誤的,先看控制台的提示信息吧!