1. 程式人生 > >PageHelper(依賴,配置檔案)

PageHelper(依賴,配置檔案)

分頁外掛(依賴,配置檔案)

版本控制
<properties>
	<spring.version>5.0.2.RELEASE</spring.version>
    <spring.security.version>5.0.1.RELEASE</spring.security.version>
</properties>


pageHelper依賴管理
<dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-web</artifactId>
        <version>${spring.security.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-config</artifactId>
        <version>${spring.security.version}</version>
    </dependency>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>javax.servlet-api</artifactId>
        <version>3.1.0</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-taglibs</artifactId>
        <version>${spring.security.version}</version>
</dependency>

pageHelpler需在dao/mapper層的sessionFactory中進行配置(其他的mybatis配置均在此處進行配置)

<!--sessionFactory-->
    <bean id="sessionFactory"  class="org.mybatis.spring.SqlSessionFactoryBean">
        <property name="dataSource" ref="dataSource"/>
    <!--配置分頁外掛-->
        <property name="plugins">
            <array>
                <!--引入實現了攔截器介面的實現類:分頁攔截器實現類-->
                <bean class="com.github.pagehelper.PageInterceptor">
                    <!--配置攔截的是哪一個資料庫-->
                    <property name="properties">
                        <props>
                            <prop key="helperDialect">oracle</prop>
                        </props>
                    </property>
                </bean>
            </array>
        </property>

	    </bean>