springmvc整合pagehelper分页插件
<!--整合mybatis到spring中-->
<bean class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="typeAliasesPackage" value="com.itheima.domain" />
<!--分页插件-->
<property name="plugins">
<array>
<bean class="com.github.pagehelper.PageInterceptor">
<!--可选配置-->
<property name="properties">
<props>
<!--配置方言-->
<prop key="helperDialect">mysql</prop>
<!--查询页码大于最大页码时返回最后一页数据-->
<prop key="reasonable">true</prop>
<!-- 设置为true时,如果pageSize=0或者RowBounds.limit = 0就会查询出全部的结果 -->
<prop key="pageSizeZero">false</prop>
</props>
</property>
</bean>
</array>
</property>
</bean>
以上内容配置在applicationContext.xml文件中。

浙公网安备 33010602011771号