mysql分页插件pagehelper不生效

在升级到SpringBoot3.5.3并尝试整合PageHelper1.4.1进行分页查询时,遇到问题。通过添加`PageHelperConfig`的配置并注入Interceptor,解决了分页不生效的问题,但原因未深究。
摘要由CSDN通过智能技术生成
问题:使用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的原因,待后续吧

  • 7
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值