项目场景:
提示:springboot+mybatisplus:
项目场景:小白初次跟着视频项目做一个blog项目
问题描述
获取文章列表的接口报错500
控制台报错
2022-04-03 17:01:51.810 ERROR 98884 --- [nio-8888-exec-1] o.a.c.c.C.[.[.[.[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.example.blog.dao.mapper.TagMapper.findTagsByArticleId] with root cause
原因分析:
网上搜索的报错原因一般情况都是所在controller中引入service时候, 忘记写注解@Resource或者 @ Autowired注解导致,我这里是mapper.xml映射没有绑定mapper,文件名称、路径要一致,查了好久才看到这里路径不对
解决方案:
把mapper路径写对,而且要放在resources下