springboot升级到2.7.12版本后启动报错 找不到符号符号:类 PaginationInterceptor

一、报错如下
Cannot resolve symbol ‘PaginationInterceptor’

二、报错原因
springboot升级到2.7.12之后,mybatis-puls分页插件版本也会随之升级,mybatis-puls分页插件升级到3.4.0版本后,PaginationInterceptor使用MybatisPlusInterceptor和PaginationInnerInterceptor替代
三、解决方式

@Configuration
public class MyBatisPlusConfig {
	/**
     * 3.4之前的版本mybatis-plus分页插件配置
     */
    @Bean
    public PaginationInterceptor paginationInterceptor() {
        PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
        paginationInterceptor.setDialectType("Oracle");
        return paginationInterceptor;
    }
    
   /**
     * 3.4之后的版本mybatis-plus分页插件配置
     */
    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor(){
        MybatisPlusInterceptor mybatisPlusInterceptor = new MybatisPlusInterceptor();
        mybatisPlusInterceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
        return mybatisPlusInterceptor;
    }
}

你可能感兴趣的:(mybatis-plus,spring,boot,后端,java)