解决方案如下:
1.添加如下配置文件
@Configuration
public class MbConfig {
@Bean
public PaginationInterceptor paginationInterceptor() {
return new PaginationInterceptor();
}
}
2.去掉pom.xml中的pagehelper插件
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>${pagehelper.spring.boot.version}</version>
</dependency>
3.执行顺序一定要对
Page<Users> usersPage=new Page<>(1,2);
usersDao.selectPage(usersPage,null);
System.out.println(usersPage.getCurrent());
System.out.println(usersPage.getTotal());
本文介绍如何在Spring Boot项目中配置MyBatis Plus分页插件,包括创建配置类、移除PageHelper依赖及正确执行分页操作的步骤。
1126

被折叠的 条评论
为什么被折叠?



