标签:class end 报错 mapper config enc org configure str
原项目系统中已经引入了 Mybatis 和 pagehelper ,当引入Mybatis-plus 后启动项目报错 SqlSessionFactory 错误,排查原因后为依赖冲突导致,需排除部分jar包
1. Mybatis中
<dependency>
<groupId>tk.mybatis</groupId>
<artifactId>mapper-spring-boot-starter</artifactId>
<version>2.1.5</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>
2. pagehelper 中
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>1.2.3</version>
需排除下面包
<exclusions>
<exclusion>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
</exclusion>
</exclusions>
</dependency>
3.引入Mybatis-plus
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.3.2</version>
</dependency>
4.引入autoconfigure
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-autoconfigure</artifactId>
<version>2.1.4</version>
</dependency>
5. 修改配置文件,将原 mybatis 改成 mybatis-plus
mybatis-plus:
mapper-locations: classpath*:/mapper/*.xml,classpath*:/mapper/**/*.xml
configuration:
mapUnderscoreToCamelCase: true
Springboot项目中Mybatis升级Mybatis-plus依赖冲突问题
标签:class end 报错 mapper config enc org configure str
原文地址:https://www.cnblogs.com/Open-ing/p/14774195.html