1.spring.xml
<bean id="sqlSessionFactory"
class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="configLocation" value="classpath:mybatis-config.xml"></property>
<property name="mapperLocations"
value="classpath:***/****/**/**/**/mapping/*.xml"></property>
<property name="plugins">
<array>
<bean class="com.github.pagehelper.PageInterceptor">
<property name="properties">
<value>
helperDialect=mysql
reasonable=true
supportMethodsArguments=true
params=count=countSql
</value>
</property>
</bean>
</array>
</property>
</bean>
2.mybatis-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE configuration
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
<settings>
<!-- 打印查询语句 -->
<!-- <setting name="logImpl" value="STDOUT_LOGGING" /> -->
<setting name="logImpl" value="STDOUT_LOGGING" />
</settings>
<!-- mapper已经在spring-mybatis.xml中的sqlSessionFactory配置,这里不再需要配置 -->
<!-- <mappers> -->
<!-- <mapper resource="classpath:***/****/**/**/**/mapping/*.xml" /> -->
<!-- </mappers> -->
</configuration>