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表名让我卡了一上午,大哭😭 )
本文介绍了解决MyBatis BindingException的具体步骤,包括检查mapper.xml配置、启动配置、项目配置文件、pom.xml设置及数据库表命名规范。
1万+

被折叠的 条评论
为什么被折叠?



