pom文件加这三个,缺一个都不行
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>1.2.5</version>
</dependency>
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
<version>5.0.3</version>
</dependency>
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-autoconfigure</artifactId>
<version>1.2.5</version>
</dependency>
controller加
PageHelper.startPage(0,3);
List list= xxxxService.getAll();//list会出来三条
mybatis-config.xml不加下面的配置也不会报错
<plugins>
<plugin interceptor="com.github.pagehelper.PageInterceptor">
<!–分页参数合理化 –>
<property name="reasonable" value="true"/>
</plugin>
</plugins>
application.xml中配置
pagehelper: helperDialect: mysql #可以配置你实际需要的数据库方言 reasonable: true supportMethodsArguments: true params: count=countSql