mybatis分页插件pageHelper的startPage方法查询失效问题

pageHelper插件可在spring配置文件(方式一)或mybatis配置文件(方式二)中配置
方式一:
 1 <bean id="mybatisSqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
 2     <property name="dataSource" ref="dataSource"/>
 3     <property name="configLocation" value="classpath:mybatis-config.xml"/>
 4     <property name="plugins">
 5         <array>
 6             <bean class="com.github.pagehelper.PageInterceptor">
 7                 <property name="properties">
 8                     <!-- config params as the following -->
 9                     <value>
10                         dialect=com.github.pagehelper.dialect.helper.OracleDialect
11                     </value>
12                 </property>
13             </bean>
14         </array>
15     </property>
16 </bean>

方式二:
1 <configuration>
2     ...
3     <plugins>
4         <plugin interceptor="com.github.pagehelper.PageInterceptor">
5             <property name="supportMethodsArguments" value="true"/>
6         </plugin>
7     </plugins>
8 </configuration>

不解的是使用方式一的配置执行startPage静态方法时会查询出所有记录来,startPage方法是失效的;而采用方式二的配置则会正常。
目前使用方式二的配置回避了这个问题,但仍然疑惑……
posted @ 2018-02-25 23:20  轻舞飞扬ly  阅读(2688)  评论(0编辑  收藏  举报