当前使用版本(必须填写清楚,否则不予处理)

mybatis-plus-boot-starter 3.0.1

该问题是怎么引起的?(请使用最新版(具体版本查看CHANGELOG.md),如还有该问题再提 issue!)

调用service的save方法引起的

重现步骤

每次必现

报错信息

org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.xxxx.db.mapper.TopicModelMapper.insert at org.apache.ibatis.binding.MapperMethod$SqlCommand.(MapperMethod.java:227) at org.apache.ibatis.binding.MapperMethod.(MapperMethod.java:49) at org.apache.ibatis.binding.MapperProxy.cachedMapperMethod(MapperProxy.java:65) at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:58) at com.sun.proxy.$Proxy108.insert(Unknown Source) at com.yscall.kulaidian.db.service.impl.TopicServiceImpl.addTopic(TopicServiceImpl.java:37) at com.yscall.kulaidian.db.service.impl.TopicServiceImpl$$FastClassBySpringCGLIB$$4b778966.invoke() at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:685) at

Comment From: songlongkuan

大兄弟 着急啊 能不能帮忙看看

Comment From: miemieYaho

mapper没扫描到

Comment From: songlongkuan

不太可能 我在没用plus之前 一直好好的 现在没用plus的mapper都正常 继承了BaseMapper的mapper 就不正常 会报这个错

Comment From: songlongkuan

算了 这东西我还是无福消受 我还是用我的Mybatis吧

Comment From: songlongkuan

关issue倒是挺快....

Comment From: qmdx

http://mp.baomidou.com/

https://gitee.com/baomidou/mybatis-plus-samples

https://gitee.com/baomidou/mybatisplus-spring-boot

Comment From: songlongkuan

文档看了好几遍了 不行

Comment From: qmdx

http://mp.baomidou.com/guide/faq.html#%E5%87%BA%E7%8E%B0-invalid-bound-statement-not-found-%E5%BC%82%E5%B8%B8

Comment From: songlongkuan

非plus的mapper 和 plus的mapper是在同一个包下 mapper肯定是能扫描到的 非plus 的mapper是可以正常使用的 但是plus的mapper 插入就报错

Comment From: qmdx

好好看看我发的那些连接,问题就是配置这块,没有自动注入。

Comment From: songlongkuan

项目是SpringBoot 2.0 这个配置按文档上加了 mybatis-plus: mapper-locations: classpath:/mapper//.xml 然后不行 我又尝试更改为我之前用Mybatis的配置 改成如下了 mybatis-plus: mapper-locations: classpath:mapper/*.xml 也还是不行

再然后 MapperScan注解也配置了 我可以肯定 绝对配置的是mapper的包名 而且同一个包下的非plus mapper正常、

不是maven多模块项目 表名叫topic 命名空间应该不会又问题

Comment From: songlongkuan

而且官方的Mybatis maven被我删了 只留下 com.baomidou mybatis-plus-boot-starter 3.0.1

Comment From: qmdx


# 参考 配置
mybatis-plus:
  configuration:
    cache-enabled: false
    map-underscore-to-camel-case: true
  mapper-locations: classpath:mapper/**/*Mapper.xml
  typeAliasesPackage: com.baomidou.ant.*.entity
  global-config:
    db-config:
      logic-delete-value: 1
      logic-not-delete-value: 0
      table-underline: true
      column-like: true

xml 在 jar 中 classpath:mapper//Mapper.xml

Comment From: songlongkuan

还是不行 = =

Comment From: DawsonYung

现在解决了吗??我也碰到了同样的问题,怎么弄都不行

Comment From: songlongkuan

没有 我已经抛弃它了

Comment From: DawsonYung

好吧 我在研究下

Comment From: DawsonYung

@pencilso 兄弟 我解决了 手残了 创建的xml时文件格式有问题

Comment From: songlongkuan

我的xml格式肯定没毛病的 我没用plus正常 用plus就不正常

Comment From: songlongkuan

只用Mybatis 没问题

Comment From: DawsonYung

哈哈哈 这样的问题 看起来 真头疼 一个个比对 肯定那块有问题

Comment From: reidchan

@pencilso 你是不是用了多数据源,我也是这种情况,就plus相关的Mapper不行,估计是多数据源的问题。

Comment From: RickFallen

@pencilso @DawsonYung 大胸弟 你应该是@MapperScan注解用错了 com.xxxx.db..mapper 是不对的 应该用com.xxxx.db.*.mapper

Comment From: TGTIFri

检查pom中mybatisplus相关依赖,重点排查重复导入或者多版本