org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):XXX 解决方案
- 检查你的
mapper.xml
中的namespace
是否配置正确 - 检查启动入口处是否配置了
@MapperScan
并做出正确配置 - 检查你的项目配置文件中(
yml
或xml
或properties
)是否指定了mybatis.mapper-locations
- 检查你的
pom.xml
中是否配置了如下:<!--将配置文件打包--> <resources> <resource> <directory>src/main/java</directory> <includes> <include>**/*.xml</include> </includes> </resource> <resource> <directory>src/main/resources</directory> <includes> <include>**/*.yml</include> <include>**/*.xml</include> <include>**/*.properties</include> </includes> </resource> </resources>
- 还有你的数据库中表的命名最好是:
tb_实体名
,在mapper.xml
中写相关表名也要写这个名字(太坑了,一个User
表名让我卡了一上午,大哭😭 )