1,导入pagehelper依赖
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
<version>5.1.2</version>
<scope>compile</scope>
</dependency>
2,配置application.xml
在ApplicationContext.xml配置pagehelper:
在创建完DataSource对象的bean后,创建sessionfactory对象的时候添加上pagehelper插件
<!-- 创建sqlsessionfactory对象 -->
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<!--关联连接池-->
<property name="dataSource" ref="dataSource"/>
<!-- 加载sql映射文件 -->
<property name="mapperLocations" value="classpath:mapper/*.xml"/>
<!--引入插件-->
<property name="plugins">