MyBatis 使用PageHelper分页不起作用

记录一个坑爹的问题,springboot坏境下使用PageHelper不起作用
PageHelper.startPage(pageNo,pageSize)
上面语句跟随的mapper查出来的总是所有数据,并没有分页。

排查之后发现问题出在pom文件依赖错了,springboot坏境要用

<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>{springbootPageHelper.version}</version>
</dependency>


而不是原来的

<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
<version>{pagehelper.version}</version>
</dependency>


因为上面的依赖缺少了

<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-autoconfigure</artifactId>
</dependency>
原文地址:https://www.cnblogs.com/lucky-girl/p/10997440.html