springboot junit 單元測試 報 Unable to find a @SpringBootConfiguration, you need to use @Context

錯誤詳細:java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you need to use @Context 解決辦法一 因爲測試類所在包和springboot主啓動類不在同一目錄下導致,可以把測試類放在和springboot主啓動類同一包下。 解決辦法二 修改目錄結構如圖 把剛創建的包設置爲Te
相關文章
相關標籤/搜索