MyBatis Plus Caused by: java.lang.ClassNotFoundException: org.mybatis.logging.LoggerFactory

一、org.mybatis.logging.LoggerFactory

报此错误大多数有多种原因导致:
1、报 java.lang.ClassNotFoundException: org.mybatis.logging.LoggerFactory 错误,因为项目集成的是 Mybatis-Plus ,所以 MP 和 Mybatis 是冲突的,不可以同时出现

2、因为 MyBatis Plus 中已经集成了分页功能,不需要单独引用 PageHelper 这个包

3、所以去掉 PageHelper 依赖,或者排除掉 mybatis和mybatis-spring 依赖

    <!-- PageHelper 分页插件 -->
    <dependency>
      <groupId>com.github.pagehelper</groupId>
      <artifactId>pagehelper-spring-boot-starter</artifactId>
      <version>1.2.5</version>
      <exclusions>
        <exclusion>
          <groupId>org.mybatis</groupId>
          <artifactId>mybatis</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.mybatis</groupId>
          <artifactId>mybatis-spring</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

注意:
1、这里是 PageHelper 依赖冲突,需要排除
2、如果其他依赖中也有 mybatis 冲突,同样也需要排除

二、Could not find class [org.mybatis.spring.boot.autoconfigure.MybatisAutoConfiguration]

解决方案:
1、此错误是缺少 mybatis-spring-boot-autoconfigure 自动装配依赖,坐标:

    <dependency>
      <groupId>org.mybatis.spring.boot</groupId>
      <artifactId>mybatis-spring-boot-autoconfigure</artifactId>
      <version>2.1.1</version>
    </dependency>

  • 14
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值