mybatis 绑定错误 not bound MyBatis绑定错误提示BindingException:Invalid bound statement (not found)的解决办法

软件发布|下载排行|最新软件

当前位置:首页IT学院IT技术

mybatis 绑定错误 not bound MyBatis绑定错误提示BindingException:Invalid bound statement (not found)的解决办法

luo奔的蜗牛   2021-03-24 我要评论
想了解MyBatis绑定错误提示BindingException:Invalid bound statement (not found)的解决办法的相关内容吗,luo奔的蜗牛在本文为您仔细讲解mybatis 绑定错误 not bound的相关知识和一些Code实例,欢迎阅读和指正,我们先划重点:mybatis,绑定错误,not,bound,下面大家一起来学习吧。

如果出现:

  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加载配置文件的配置!

如下:

<build>
  <resources>
    <resource>
        <directory>src/main/java</directory>
      <includes>
        <include>**/*.xml</include>
      </includes>
    </resource>
    <resource>
      <directory>src/main/resources</directory>
    </resource>
  </resources>
</build>

以上所述是小编给大家介绍的MyBatis绑定错误提示BindingException:Invalid bound statement (not found)的解决方法,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对网站的支持!

Copyright 2022 版权所有 软件发布 访问手机版

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们