报错信息:Invalid bound statement (not found): 找不到绑定的mapper
解决步骤
看target 目录下是否存在mapper.xml 文件,如果不存在的话,应该是因为你的mapper.xml是放在java文件夹下,而不是resources目录下。这就需要在pom.xml文件下配置resources。
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.yml</include>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
<filtering>false</filtering>
</resource>
<resource>
<directory>src/main/resources</directory>
<includes> <include>**/*.yml</include>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>
但我的问题出现在SpringBootTest中,在项目中可以正常运行。但是在进行单元测试时无法找到相关mapper
找了很多帖子都无法解决,最后将yml 中的 mapperLocations 的配置路径 的* 改为了具体的包名,解决问题。