引入依赖
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
<version>4.2.0</version>
</dependency>
<plugins>
<!-- com.github.pagehelper为PageHelper类所在包名 -->
<plugin interceptor="com.github.pagehelper.PageHelper">
<!-- 使用下面的方式配置参数,后面会有所有的参数介绍 -->
<!-- <property name="param1" value="value1"/>-->
</plugin>
</plugins>
或者从github中查看文档如何使用
或在spring配置文件中:
<bean id="sessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<!-- <property name="dataSource" ref="dataSource"></property>-->
<!-- <property name="configLocation" value="classpath:mybatisConfig.xml"></property>-->
<property name="plugins">
<array>
<bean class="com.github.pagehelper.PaginationInterceptor">
<property name="properties">
<!--使用下面的方式配置参数,一行配置一个 -->
<value>
<!-- params=value1-->
</value>
</property>
</bean>
</array>
</property>
</bean>