错误:
Correct the classpath of your application so that it contains a single, compatible version of com.baomidou.mybatisplus.core.MybatisConfiguration
原因:
- .由于原来采用分页用的是github.pagehelper,
<!--分页github.pagehelper-->
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>1.2.10</version>
</dependency>
这个包中有一个mybatis依赖,版本是3.4.6:
<dependency>
<artifactId>mybatis</artifactId>
<groupId>org.mybatis</groupId>
<version>3.4.6</version>
</dependency>
- 而我引入了代码生成器的依赖:mybatis-plus-generator中也依赖mybatis这个包,版本是3.5.4;
<!-- 代码生成 -->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-generator</artifactId>
<version>3.3.2</version>
</dependency>
导致mybatis包冲突;
解决:用exclusions标签,去除pagehelper中的mybaits依赖;
<!--分页github.pagehelper-->
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>1.2.10</version>
<exclusions>
<exclusion>
<artifactId>mybatis</artifactId>
<groupId>org.mybatis</groupId>
</exclusion>
</exclusions>
</dependency>```