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>
