mybatis面试题|MyBatis绑定错误提示BindingException:Invalid bound statement (not found)的解决方法

时间:2021-06-11  来源:apache  阅读:

如果出现:

org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)

一般的原因是Mapper interface和xml文件的定义对应不上,需要检查包名,namespace,函数名称等能否对应上。

按以下步骤一一执行:

1、检查xml文件所在的package名称是否和interface对应的package名称一一对应

2、检查xml文件的namespace是否和xml文件的package名称一一对应

3、检查函数名称能否对应上

4、去掉xml文件中的中文注释

5、随意在xml文件中加一个空格或者空行然后保存

注意:在使用IDEA开发时,如果打包时*Mapper.xml没有自动复制到class输出目录的mapper类包下,则需要在pom文件中添加mybatis加载配置文件的配置!

如下:

 代码如下

src/main/java

**/*.xml

src/main/resources

mybatis面试题|MyBatis绑定错误提示BindingException:Invalid bound statement (not found)的解决方法

http://m.bbyears.com/jiaocheng/123085.html

推荐访问:mybatis原理
相关阅读 猜你喜欢
本类排行 本类最新