在Spirng Boot中集成了PageHelper,然后也在需要使用分頁的地方加入了如下代碼:
PageHelper.startPage(1,1);
但是就是不生效呢,數(shù)據(jù)庫的所有數(shù)據(jù)都查詢出來了這是咋回事呢?
以前遇到過一個(gè)問題,有的版本沒有攔截器接口,導(dǎo)致pagehelper插件不能用,難道這次也是版本問題?
于是改動(dòng)了可能的版本,由:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.2.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>1.1.0</version>
</dependency>
改為:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.8.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>1.2.3</version>
</dependency>
然后發(fā)現(xiàn)好使了。
最終確認(rèn),只改動(dòng)springboot 版本號就可以了。
具體原因,有待思考。