SpringBoot測試類啓動錯誤 java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you ne

報錯

java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you need to use @ContextConfiguration or @SpringBootTest(classes=...) with your test
......
......
......
......
......
......
......

 

我當時運行SpringBoot測試類的時候踩這個坑,當時的解決辦法就是,本來的包名爲test如今改成panfeng就好了.

這裏的主配置類也就是`PanfengUploadApplication`所在包是 java 下的 `panfeng`java

因此測試類的`FastDFSTest`也要在 java 下的 `panfeng`包測試

相關文章
相關標籤/搜索