配置mybatis的分页插件
一:在pom.xml引入相应jar
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
<version>5.0.1</version>
</dependency>
二:有spring的环境的配置
<!--配置SqlSessionFactory-->
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<!--别名的配置 domain,query-->
<property name="typeAliasesPackage" value="cn.itsource.ssm.domain,cn.itsource.ssm.query"/>
<!--mapper的映射文件:配置所有的映射文件-->
<property name="mapperLocations" value="classpath*:cn/itsource/ssm/mapper/*.xml"/>
<!--分页插件配置-->
<property name="plugins">
<array>
<bean class="com.github.pagehelper.PageInterceptor">
<property name="properties">
<value>helperDialect=mysql
reasonable=false
supportMethodsArguments=true
params=count=countSql
autoRuntimeDialect=true
</value>
</property>
</bean>
</array>
</property>
</bean>
二.一普通maven环境中的配置
<plugin interceptor="com.github.pagehelper.PageInterceptor"> </plugin>
测试: