MyBatis-Plus分頁依賴衝突及棄用提示
阿新 • • 發佈:2021-02-04
1、採用pagehelper分頁,會產生依賴衝突問題
需在pom中排除mybatis
<dependency> <groupId>com.github.pagehelper</groupId> <artifactId>pagehelper</artifactId> <version>5.1.10</version> <exclusions> <exclusion> <groupId>org.mybatis</groupId> <artifactId>mybatis</artifactId> </exclusion> <exclusion> <groupId>org.mybatis</groupId> <artifactId>mybatis-spring</artifactId> </exclusion> </exclusions> </dependency>
2、採用PaginationInterceptor分頁外掛,會提示過時
從MyBatis-Plus3.4.0版開始,PaginationInterceptor
棄用,新版本改用MybatisPlusInterceptor
@Configuration public class MybatisPlusConfig { @Bean public MybatisPlusInterceptor mybatisPlusInterceptor(){ MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL)); return interceptor; } }