mybatis-config.xml配置
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.0.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd">
<!-- Activates annotation-based bean configuration -->
<context:annotation-config />
<!-- 导入属性配置文件 -->
<!--
<context:property-placeholder location="classpath:orcl.properties" order="1" />
-->
<!-- 配置数据源 -->
<bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource"
init-method="init" destroy-method="close">
<property name="driverClassName" value="${ora.jdbc.driverClassName}" />
<property name="url" value="${ora.jdbc.url}" />
<property name="username" value="${ora.jdbc.username}" />
<property name="password" value="${ora.jdbc.password}" />
<property name="minIdle" value="${ora.jdbc.minIdle}" /> <!-- 队列中的最小等待数 -->
<!-- <property name="maxIdle" value="${ora.jdbc.maxIdle}" /> 队列中的最大等待数 -->
<property name="maxWait" value="${ora.jdbc.maxWait}" /> <!-- 最长等待时间,单位毫秒 -->
<property name="maxActive" value="${ora.jdbc.maxActive}" /> <!-- 最大活跃数 -->
<property name="initialSize" value="${ora.jdbc.initialSize}" /><!-- 初始大小 -->
<property name="filters" value="stat" /><!-- 配置监控统计拦截的filters,去掉后监控界面sql无法统计 -->
<property name="validationQuery" value="${ora.jdbc.validationQuery}" />
<property name="testWhileIdle" value="true" />
<property name="testOnBorrow" value="false" />
<property name="testOnReturn" value="false" />
</bean>
<!-- 使用JDBC事物 -->
<bean id="oraTxManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource" />
</bean>
<!-- 使用annotation定义事务 -->
<tx:annotation-driven transaction-manager="oraTxManager"
proxy-target-class="true" />
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="configLocation" value="classpath:sqlMapConfig.xml" />
<property name="dataSource" ref="dataSource" />
<property name="mapperLocations" value="classpath:com/syy/sys/**/domain/*Mapper.xml"></property>
<property name="plugins">
<!-- <list> -->
<!-- <bean -->
<!-- class="com.github.miemiedev.mybatis.paginator.OffsetLimitInterceptor"> -->
<!-- <property name="dialectClass" -->
<!-- value="com.github.miemiedev.mybatis.paginator.dialect.SQLServer2005Dialect"></property> -->
<!-- </bean> -->
<!-- </list> -->
<array>
<bean class="com.github.pagehelper.PageHelper" />
</array>
</property>
</bean>
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<!--
<property name="annotationClass" value="org.springframework.stereotype.Repository" />
-->
<property name="basePackage" value="com.syy.sys.domain.mapper" />
<!--
<property name="sqlSessionFactory" ref="sqlSessionFactory" />
-->
</bean>
</beans>