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