1.pom.xml添加com.github.pagehelper依赖后编译。

<dependency>
            <groupId>com.github.pagehelper</groupId>
            <artifactId>pagehelper</artifactId>
            <version>4.1.6</version>
        </dependency>

2.添加配置@Configuration文件,从Spring3.0,@Configuration用于定义配置类,可替换xml配置文件,被注解的类内部包含有一个或多个被@Bean注解的方法,这些方法将会被AnnotationConfigApplicationContext或AnnotationConfigWebApplicationContext类进行扫描,并用于构建bean定义,初始化Spring容器。

Sprint Boot项目搭建STEP4:Sprint Boot Mybatis 分页整合

3.在SqlSessionFactory里添加该插件

Sprint Boot项目搭建STEP4:Sprint Boot Mybatis 分页整合

bean.setPlugins(new Interceptor[] { pageHelper });

4.使用

相关文章:

  • 2022-03-04
  • 2021-11-01
  • 2022-12-23
  • 2022-12-23
  • 2021-12-12
  • 2022-12-23
  • 2022-12-23
  • 2021-09-18
猜你喜欢
  • 2021-12-29
  • 2021-05-03
  • 2022-01-02
  • 2022-12-23
  • 2021-07-15
  • 2021-05-29
  • 2019-02-27
相关资源
相似解决方案