目录
1、Mapper.xml中mapper namespace路径不准确
2、TextDao(接口)与TextMapper.xml id标签不一致 编辑
3、application.properties中配置mybatis.type-aliases-package=com.demo.entity需要与Text实体类路径一致
5、TextMapper.xml 路径需要在 resource目录下
6、确认mapper.xml文件有没有在target目录下成功构建
报错如下:
1、Mapper.xml中<mapper namespace="com.demo.dao.TextDao">路径不准确
2、TextDao(接口)与TextMapper.xml id标签不一致 ![](https://i-blog.csdnimg.cn/blog_migrate/582aed842a72c6866cf64c4220780fbd.png)
3、application.properties中配置mybatis.type-aliases-package=com.demo.entity需要与Text实体类路径一致
4、pom.xml文件中需要配置<resource>标签
<resources>
<!--将Java代码下的xml编译到class下面去-->
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
<include>**/*.yml</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
<include>**/*.yml</include>
</includes>
</resource>
</resources>
5、TextMapper.xml 路径需要在 resource目录下
6、确认mapper.xml文件有没有在target目录下成功构建
参考:Invalid bound statement (not found)出现原因和解决方法_invalid bound statement (not found):-CSDN博客解决Mybatis 报错Invalid bound statement (not found) - 卷卷丶 - 博客园 (cnblogs.com)