spring-config-dao.xml
3.4 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
<?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:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd"
default-autowire="byName">
<context:component-scan base-package="com.dili.titan.dao" />
<!--<bean id="abstractDataSource" abstract="true" class="com.jolbox.bonecp.BoneCPDataSource" destroy-method="close">-->
<!--<property name="driverClass" value="${jdbc.driverClass}" />-->
<!--<property name="idleConnectionTestPeriodInMinutes" value="${jdbc.idleConnectionTestPeriod}" />-->
<!--<property name="idleMaxAgeInMinutes" value="${jdbc.idleMaxAge}" />-->
<!--<property name="maxConnectionsPerPartition" value="${jdbc.maxConnectionsPerPartition}" />-->
<!--<property name="minConnectionsPerPartition" value="${jdbc.minConnectionsPerPartition}" />-->
<!--<property name="partitionCount" value="${jdbc.partitionCount}" />-->
<!--<property name="acquireIncrement" value="${jdbc.acquireIncrement}" />-->
<!--<property name="statementsCacheSize" value="${jdbc.statementsCacheSize}" />-->
<!--<property name="releaseHelperThreads" value="${jdbc.releaseHelperThreads}" />-->
<!--</bean>-->
<!--<bean id="masterDataSource" parent="abstractDataSource">-->
<!--<property name="jdbcUrl" value="${jdbc.jdbcUrl}" />-->
<!--<property name="username" value="${jdbc.username}" />-->
<!--<property name="password" value="${jdbc.password}" />-->
<!--</bean>-->
<bean id="masterDataSource" class="com.alibaba.druid.pool.DruidDataSource"
init-method="init" destroy-method="close">
<property name="driverClassName" value="${jdbc.driverClass}"/>
<property name="url" value="${jdbc.jdbcUrl}"/>
<property name="username" value="${jdbc.username}"/>
<property name="password" value="${jdbc.password}"/>
<property name="filters" value="stat"/>
<property name="maxActive" value="${jdbc.maxActive}"/>
<property name="initialSize" value="${jdbc.initialSize}"/>
<property name="maxWait" value="${jdbc.maxWait}"/>
<property name="minIdle" value="${jdbc.minIdle}"/>
<property name="timeBetweenEvictionRunsMillis"
value="${jdbc.timeBetweenEvictionRunsMillis}"/>
<property name="minEvictableIdleTimeMillis"
value="${jdbc.minEvictableIdleTimeMillis}"/>
<property name="validationQuery" value="SELECT now()"/>
<property name="testWhileIdle" value="true"/>
<property name="testOnBorrow" value="false"/>
<property name="testOnReturn" value="false"/>
<property name="poolPreparedStatements"
value="${jdbc.poolPreparedStatements}"/>
<property name="maxOpenPreparedStatements"
value="${jdbc.maxOpenPreparedStatements}"/>
</bean>
<bean id="sessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="masterDataSource" />
<property name="configLocation" value="classpath:sqlmap/sqlmap-config.xml" />
</bean>
<bean id="sqlTemplate" class="org.mybatis.spring.SqlSessionTemplate">
<constructor-arg index="0" ref="sessionFactory" />
</bean>
</beans>