背景:
SpringBoot项目启动成功,访问API时报错。页面显示 whitelabel error page,
控制台报错:Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request
原因:
Service层实现类未添加注解@Autowired。
@Autowired的作用是自动注入依赖的Bean。
修改方法:
加上注解。
背景:
SpringBoot项目启动成功,访问API时报错。页面显示 whitelabel error page,
控制台报错:Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request
原因:
Service层实现类未添加注解@Autowired。
@Autowired的作用是自动注入依赖的Bean。
修改方法:
加上注解。