PageHelper和mybatis-plus结合使用的坑

推荐版本

<!--    mybatis-plus    -->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.5.1</version>
</dependency>

注意:如果是mybatis-plus替换mybatis时需要将mybatis依赖删除
<!-- pagehelper 分页-->
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<optional>true</optional>
<version>1.4.1</version>
</dependency>
pagehelper 版本太低启动时会出现Factory method 'sqlSessionFactory' threw exception; nested exception is java错误
pagehelper 从1.2.6升到1.4.1版本后pagehelper.page-size-zero=true替换成pagehelper.pageSizeZero=true才能在 PageHelper.startPage(page, size);page和size都为0时查询所有数据

同时:
#解决升级 Spring Boot 2.6后,因循环引用导致启动时报错的问题
spring.main.allow-circular-references=true


posted on 2022-08-15 13:55  木_-_木  阅读(581)  评论(0编辑  收藏  举报