SpringBoot 使用分页插件 PageHelper 分页无效


SpringBoot 使用分页插件 PageHelper 分页无效


最近使用github上开源的 pagehelper 的分页插件无效,找了网上的解决方便,做个记录


  • 分页无效代码:
    在这里插入图片描述

问题原因:

由于 SpringBoot 的版本变换,所以导致很多 maven 依赖也需要更新


解决方法:

现在都用 spring-boot 2.x.x 版本了,所以需要更换老版本的 maven 依赖,只需要将下面的 maven 依赖换成对应 springboot 版本的依赖即可即可

  • spring-boot 1.x.x 的版本:
<!-- 分页工具 -->
<dependency>
    <groupId>com.github.pagehelper</groupId>
    <artifactId>pagehelper</artifactId>
    <version>4.1.3</version>
</dependency>
  • spring-boot 2.x.x 的版本:
<!-- 分页工具 -->
<dependency>
    <groupId>com.github.pagehelper</groupId>
    <artifactId>pagehelper-spring-boot-starter</artifactId>
    <version>1.2.5</version>
</dependency>

猜你喜欢

转载自blog.csdn.net/qq_25112523/article/details/107795380