如果在使用mapper.xml时报了Invalid bound statement (not found)的错误,并且自己的mapper.xml的路径和文件名都没有错误的情况,很可能是因为没有在pom.xml中配置如下代码:
<!-- 如果不添加此节点mybatis的mapper.xml文件都会被漏掉。 -->
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
<filtering>false</filtering>
</resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>
如果不配置resource的话,mapper.xml文件就会读取不到。
转自:https://blog.csdn.net/LM891108647/article/details/81437627