SoFunction
Updated on 2025-04-13

Summary of the usage of Mybatis Plus 3.4.0 pagination interceptor

Starting from the MyBatis-Plus 3.4.0 version, it is officially recommended to use MybatisPlusInterceptor to replace PaginationInterceptor in the older version. MybatisPlusInterceptor is an interceptor that integrates multiple functions and supports multiple plug-ins, such as paging plug-ins, performance analysis plug-ins, etc. By calling the addInnerInterceptor() method, the interceptor has various functions. The following is the official documentation for pagination plug-in configuration under the SpringBoot framework

Mybatis Plus 3.4.0

The following built-in plug-ins have been added:
Main plugin: MybatisPlusInterceptor
The plugin internal plugin set:

  • Pagination plugin: PaginationInnerInterceptor
  • Multi-tenant plugin: TenantLineInnerInterceptor
  • Dynamic table name plugin: DynamicTableNameInnerInterceptor
  • Optimistic LockerInnerInterceptor
  • sql performance specification plugin: IllegalSQLInnerInterceptor
  • Plugins to prevent full table updates and deletion: BlockAttackInnerInterceptor

spring cloud alibaba configuration paging plugin

@Configuration
@MapperScan("")
public class MybatisPlusConfig {

    /**
      * New paging plug-in, one to ease and two to ease follow the rules of mybatis, and MybatisConfiguration#useDeprecatedExecutor = false to avoid cache problems (this property will be removed together after the old plug-in is removed)
      */
    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor() {
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
        (new PaginationInnerInterceptor(DbType.H2));
        return interceptor;
    }

    @Bean
    public ConfigurationCustomizer configurationCustomizer() {
        return configuration -> (false);
    }
}

For more detailed tutorials, please refer to the official address:/guide/#%E4%BD%BF%E7%94%A8%E6%96%B9%E5%BC%8F-%E4%BB%A5%E5%88%86%E9%A1%B5%E6%8F%92%E4%BB%B6%E4%B8%BE%E4%BE%8B

Application Cases

Matecloud uses the Mybatis plus 3.4.0 version as application scenario, see:
/matevip/matecloud

This is the article about the usage of Mybatis Plus 3.4.0 pagination interceptor. For more information about Mybatis Plus 3.4.0 pagination interceptor, please search for my previous articles or continue browsing the related articles below. I hope you will support me more in the future!