SpringBoot整合pagehelper分页插件就两步:
第一步:导入依赖
第二步:配置application.yml文件
第一步导入依赖要注意
方法一:导入pagehelper和pagehelper-spring-boot-autoconfigure
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
<version>5.1.10</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.github.pagehelper/pagehelper-spring-boot-autoconfigure -->
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-autoconfigure</artifactId>
<version>1.4.6</version>
</dependency>
方法二:导入pagehelper-spring-boot-starter
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>1.4.6</version>
</dependency>
方法二注意因为导入的是pagehelper-spring-boot-starter包含以下四个依赖
如果已经导入了mybatis-spring-boot-starter建议使用方法一,因为使用方法二可能会导致包冲突