mybatis和mybatis-plus一起使用导致启动失败和Invalid bound statement (not found)问题

问题一:启动失败

解决办法:pom.xml文件中修改mybatis依赖为如下内容,排除不必要的依赖。

<!--    mybatis依赖-->
    <dependency>
      <groupId>org.mybatis.spring.boot</groupId>
      <artifactId>mybatis-spring-boot-starter</artifactId>
      <version>2.1.3</version>
      <!--Mybatis中需要排除下面2个依赖-->
      <exclusions>
        <exclusion>
          <groupId>org.mybatis</groupId>
          <artifactId>mybatis</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.mybatis</groupId>
          <artifactId>mybatis-spring</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

问题:Invalid bound statement (not found)

原因:本版不兼容

解决方法:提高mybatis-plus的版本号,可以参考我这两个依赖对应的版本。我的实列在已经可以正常运行。

<!--    mybatis依赖-->
    <dependency>
      <groupId>org.mybatis.spring.boot</groupId>
      <artifactId>mybatis-spring-boot-starter</artifactId>
      <version>2.1.3</version>
      <!--Mybatis中需要排除下面2个依赖-->
      <exclusions>
        <exclusion>
          <groupId>org.mybatis</groupId>
          <artifactId>mybatis</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.mybatis</groupId>
          <artifactId>mybatis-spring</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
<!--    mybatis-plus依赖-->
    <dependency>
      <groupId>com.baomidou</groupId>
      <artifactId>mybatis-plus-boot-starter</artifactId>
      <version>3.5.4</version>
    </dependency>

以上就是我的解决方法了。至于其它原因导致的Invalid bound statement (not found)问题,有可能是mapper.xml中namespace或者方法id导致的,它们的解决方法我就不在这里赘述了。这里这讨论了项目依赖的兼容和版本问题。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值