Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception

403 阅读1分钟

前言

从网上找了个SpringBoot整合各种东西的项目,在调试过程中出现了此问题。

问题

Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception

排查原因

  • controller层没有加@ResponseBody
  • Service层实现类未添加注解@Autowired
  • @RestController使用成了@Controller

解决方案

项目中service层注解未添加,添加后rebuild,成功解决
(每个人的问题原因各有不同,自行斟酌)