dao.xml
2.53 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
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.springframework.org/schema/beans"
xmlns:tx="http://www.springframework.org/schema/tx"
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.xsd">
<tx:annotation-driven transaction-manager="canrdTransactionManager" />
<bean id="canrdTransactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="canrdDataSource" />
</bean>
<bean id="abstractDataSource" class="org.apache.tomcat.jdbc.pool.DataSource" destroy-method="close" abstract="true">
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="testWhileIdle" value="true" />
<property name="validationQuery" value="SELECT 1" />
<property name="validationQueryTimeout" value="1000" />
<property name="removeAbandoned" value="true" />
<property name="removeAbandonedTimeout" value="300" />
</bean>
<bean id="canrdDataSource" parent="abstractDataSource">
<property name="name" value="canrd" />
<property name="url" value="${jdbc.canrd.url}" />
<property name="username" value="${jdbc.canrd.username}" />
<property name="password" value="${jdbc.canrd.password}" />
<property name="maxActive" value="${jdbc.canrd.max.conn}" />
<property name="maxIdle" value="${jdbc.canrd.max.conn}" />
<property name="initialSize" value="${jdbc.canrd.min.conn}" />
<property name="minIdle" value="${jdbc.canrd.min.conn}" />
<property name="maxWait" value="${jdbc.canrd.wait.millis}" />
</bean>
<bean id="abstractSqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean" abstract="true">
<property name="configLocation" value="classpath:mybatis-config.xml" />
</bean>
<bean id="canrdSqlSessionFactory" parent="abstractSqlSessionFactory">
<property name="dataSource" ref="canrdDataSource" />
<property name="typeAliasesPackage" value="com.canrd.patent.dal.model" />
<property name="mapperLocations" value="classpath:mapper/*.xml" />
</bean>
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="sqlSessionFactoryBeanName" value="canrdSqlSessionFactory" />
<property name="basePackage" value="com.canrd.patent.dal.mapper" />
</bean>
<bean id="sqlSession" class="org.mybatis.spring.SqlSessionTemplate">
<constructor-arg index="0" ref="canrdSqlSessionFactory" />
</bean>
</beans>