Springboot2.7.0 集成pagehelper问题解决
错误原因:
springboot2.6+版本默认禁止循环依赖、增强Docker镜像构建…
解决方式1: 启动类扫描过滤
@SpringBootApplication(exclude = {PageHelperAutoConfiguration.class})
解决方式2: 配置文件添加循环允许
spring:
main:
allow-circular-references: true
测试分页代码:
PageHelper.startPage(1, 2);
List<User> users= service.list();
PageInfo<User> pageInfo = new PageInfo<User>(list);
Console.log("page Total:{} ,now size:{}", pageInfo.getTotal(), list.size());