Servlet.service() for servlet [dispatcherServlet] in context with path [] 報錯解決方法


SpringBoot項目啟動成功,訪問API時報錯。頁面顯示

Whitelabel Error Page

This application has no explicit mapping for /error, so you are seeing this as a fallback.

控制台報錯:Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request 

原因:
Service層實現類未添加注解@Autowired。
@Autowired的作用是自動注入依賴的Bean。

修改方法:

加上@Autowired注解。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM