mysql分页插件pagehelper不生效

问题:使用springboot3集成整合pagehelper时,发现分页未生效
现象:
		<dependency>
            <groupId>com.baomidou</groupId>
            <artifactId>mybatis-plus-boot-starter</artifactId>
            <version>3.5.3</version>
        </dependency>
        <!-- mybatis分页插件 -->
        <dependency>
            <groupId>com.github.pagehelper</groupId>
            <artifactId>pagehelper-spring-boot-starter</artifactId>
            <version>1.4.1</version>
        </dependency>
 PageHelper.startPage(req.getPageNum(),req.getPageSize());
 businessMapper.list(req);

之前项目,就这样设置,就可以分页查询了,但是这次用了springboot3后就不生效了。

解决
@Configuration
public class PageHelperConfig {

    @Bean
    public Interceptor[] plugins() {
        return new Interceptor[]{new PageInterceptor()};
    }
}

增加上面的配置就好了。

简单记录一下,没去深入探究原因,也没敲定是否是springboot3的原因,待后续吧

你可能感兴趣的:(mysql,数据库)