applicationContext-dal.xml 4.65 KB
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd

http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd">
<!--我们自己的公网服务器库 begin-->
<bean name="masterdataSourceB" class="com.alibaba.druid.pool.DruidDataSource" init-method="init"
destroy-method="close">
<property name="url" value="${mysql.master.jdbcurl}"/>
<property name="username" value="${mysql.master.db.name}"/>
<property name="password" value="${mysql.master.db.password}"/>

<property name="initialSize" value="10"/>
<property name="maxActive" value="50"/>
<!--<property name="maxIdle" value="10"/>-->
<property name="minIdle" value="2"/>
<property name="maxWait" value="5000"/>
<!-- <property name="validationQuery" value="${validationQuery3}" /> -->
<property name="testOnBorrow" value="true"/>
<property name="testOnReturn" value="false"/>
<property name="testWhileIdle" value="true"/>
<property name="timeBetweenEvictionRunsMillis" value="60000"/>
<property name="minEvictableIdleTimeMillis" value="25200000"/>
<property name="removeAbandoned" value="true"/>
<property name="removeAbandonedTimeout" value="1800"/>
<property name="logAbandoned" value="true"/>
<property name="filters" value="stat"/>
</bean>

<bean id="masterSqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="masterdataSourceB"/>
<property name="configLocation" value="classpath:mybatis.xml"/>
<property name="mapperLocations">
<list>
<value>classpath*:mainOrm/master/*.xml</value>
</list>
</property>
</bean>
<!-- all class in the back-package are auto loaded as a mapper -->
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="sqlSessionFactoryBeanName" value="masterSqlSessionFactory"></property>
<property name="basePackage" value="com.lyms.platform.permission.dao.master"/>
</bean>
<!--我们自己的公网服务器库 end-->

<!-- DataSource configuration 数据仓库主数据库 -->
<bean id="reportDataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
<property name="driverClass" value="${report.driver}"/>
<property name="jdbcUrl" value="${report.jdbcurl}"/>
<property name="user" value="${report.username}"/>
<property name="password" value="${report.password}"/>
<property name="maxPoolSize" value="${report.maxpoolsize}"/>
<property name="initialPoolSize" value="${report.initialpoolsize}"/>
<property name="maxIdleTime" value="7200"></property>
<property name="acquireRetryDelay" value="1000"></property>
<property name="breakAfterAcquireFailure" value="false"></property>
<property name="acquireRetryAttempts" value="3"/>
<property name="minPoolSize" value="${report.minpoolsize}"/>
</bean>

<bean id="reportJdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate"
p:dataSource-ref="reportDataSource"/>

<bean id="reportSqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="reportDataSource"/>
<property name="mapperLocations">
<list>
<value>classpath*:reportOrm/*.xml</value>
</list>
</property>
</bean>

<!-- manage transaction -->
<bean id="reportTransactionManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="reportDataSource"/>
</bean>

<tx:annotation-driven transaction-manager="reportTransactionManager"/>

<!-- Mabatis Data Layer -->
<bean id="reportSqlSessionTemplate" class="org.mybatis.spring.SqlSessionTemplate">
<constructor-arg index="0" ref="reportSqlSessionFactory"/>
</bean>

<!-- all class in the back-package are auto loaded as a mapper -->
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="sqlSessionFactoryBeanName" value="reportSqlSessionFactory"></property>
<property name="basePackage" value="com.lymsh.platform.reportdata.dao"/>
</bean>
</beans>