错误原因:mapper文件不匹配
- 检查 mapper 文件有没有写错
- 检查 mybatis配置文件里mapper的导入,注意不能跨包导入mapper
- 检查 target/classes 里有没有生成对应的mapper文件,如果没有,解决办法如下
在pom.xml中加入以下配置,并clean后重新编译
</build>
<resources>
<resource>
<directory>src/main/java</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.*</include>
</includes>
</resource>
</resources>
</build>