1. 程式人生 > >IDEA解決"Could not autowire. No beans of 'xxxx' type found"的錯誤提示

IDEA解決"Could not autowire. No beans of 'xxxx' type found"的錯誤提示

創建 myba wire 配置 bean 問題 意思 per 路徑

使用IDEA開發Spring Boot項目的時候,利用註解的方式整合Mybatis。在運行的時候有可能會出現"Could not autowire. No beans of ‘xxxx‘ type found"的錯誤提示,這個提示的意思就是沒有找到該類型的bean,也就是說創建dao層的實例失敗。

這種情況一般是配置註解的時候沒有掃描到mapper層,但是有的時候明明路徑配置沒有問題還是會出現這個問題,這個時候有可能是因為IDEA本身的問題。

解決辦法是在mapper層添加註解@Repository

這個問題的原因還不清楚,之後了解清楚後會進行補充...

IDEA解決"Could not autowire. No beans of 'xxxx' type found"的錯誤提示