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的原因,待后续吧
原文地址:https://blog.csdn.net/gsc1456/article/details/135457197
免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!