解决org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)问题

org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)问题,即在mybatis中dao接口与mapper配置文件在做映射绑定的时候出现问题,简单说,就是接口与xml要么是找不到,要么是找到了却匹配不到。
大概问题出现的点:

1、dao文件和xml文件名不一致导致

2、dao里面的方法在xml不存在,或者参数类型有问题,返回类型匹配不上

3、yml文件没有配 mapper-locations

复制代码
mybatis-plus:
  configuration:
    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
  mapper-locations: classpath*:com/zyx/mybatisplusdemo/mapper/*Mapper.xml
  global-config:
    db-config:
      id-type: assign_id  #主键类型
      table-underline: true  #默认数据库表下划线
  type-aliases-package: com.zyx.mybatisplusdemo.entity
复制代码

注意!!!如果你的xml文件不是放在resources目录下的话,还要在pom文件增加配置,本宝宝就是在这里被坑死了,搞了两个小时才找到资料,完美解决

 

 

posted @   smellycats  阅读(774)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· PowerShell开发游戏 · 打蜜蜂
· 在鹅厂做java开发是什么体验
· 百万级群聊的设计实践
· WPF到Web的无缝过渡:英雄联盟客户端的OpenSilver迁移实战
· 永远不要相信用户的输入:从 SQL 注入攻防看输入验证的重要性
点击右上角即可分享
微信分享提示