原文:SpringBoot: Field xxx in xxx required a bean of type 'xxx' that could not be found.

SpringBoot自動注入報了如下錯誤 原因是我這個模塊依賴另一個模塊里面的被Spring管理的類,但是不在同一包下面, 並且啟動類不是在根包下面,所以就導致了springboot啟動的時候掃描不到,也就管理不到這個類,也就無法找到, 解決方案: .SpringBoot啟動類放到包的跟包下面比如每個包都包含 cn.arebirth.xx 那就放在cn.arbeirth下面 .設置SpringBo ...

2020-01-03 20:26 0 1093 推薦指數:

查看詳情

Field XXX in XXXX required a bean of type XXXX that could not be found

這個報錯的意思是:沒有找到相應的bean。 出現這個情況我遇到了兩種: 1.spring沒有掃描到相應的bean。 原因是springboot項目啟動,只有@SpringBootApplication 所在的包被被掃描,如果有其他需要掃描的包,需要顯式寫明 ...

Sat Oct 27 18:53:00 CST 2018 0 10210
 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM