- <? xml version = "1.0" encoding = "UTF-8" ?>
- <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd" >
- < beans >
- < bean id = "propertyConfigurer" class = "org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" >
- < property name = "locations" >
- < list >
- < value > classpath*:config/jdbc.properties </ value >
- </ list >
- </ property >
- </ bean >
- <!-- ========================= RESOURCE DEFINITIONS ========================= -->
- < bean id = "dataSource" class = "com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method = "close" >
- < property name = "driverClass" value = "${jdbc.driverClassName}" />
- < property name = "jdbcUrl" value = "${jdbc.url}" />
- < property name = "properties" >
- < props >
- < prop key = "c3p0.minPoolSize" > 1 </ prop >
- < prop key = "hc3p0.maxPoolSize" > 10 </ prop >
- < prop key = "hc3p0.timeout" > 60 </ prop >
- < prop key = "c3p0.max_statement" > 50 </ prop >
- < prop key = "c3p0.testConnectionOnCheckout" > true </ prop >
- < prop key = "hibernate.c3p0.testConnectionOnCheckout" > false </ prop >
- < prop key = "user" > ${jdbc.username} </ prop >
- < prop key = "password" > ${jdbc.password} </ prop >
- </ props >
- </ property >
- </ bean >
- <!-- Transaction manager for a single JDBC DataSource -->
- < bean id = "transactionManager" class = "org.springframework.jdbc.datasource.DataSourceTransactionManager" >
- < property name = "dataSource" ref = "dataSource" />
- </ bean >
- <!-- SqlMap setup for iBATIS Database Layer -->
- < bean id = "sqlMapClient" class = "org.springframework.orm.ibatis.SqlMapClientFactoryBean" >
- < property name = "configLocation" value = "classpath:config/sql-map-config.xml" />
- < property name = "dataSource" ref = "dataSource" />
- </ bean >
- < bean id = "txProxyTemplate" class = "org.springframework.transaction.interceptor.TransactionProxyFactoryBean"
- lazy-init = "true" >
- < property name = "transactionManager" > < ref bean = "transactionManager" /> </ property >
- <!--指明事务属性-->
- < property name = "transactionAttributes" >
- < props >
- < prop key = "insert*" > PROPAGATION_REQUIRED </ prop >
- < prop key = "get*" > PROPAGATION_REQUIRED,readOnly </ prop >
- < prop key = "save*" > PROPAGATION_REQUIRED </ prop >
- < prop key = "remove*" > PROPAGATION_REQUIRED </ prop >
- < prop key = "*" > PROPAGATION_REQUIRED,readOnly </ prop >
- </ props >
- </ property >
- </ bean >
- </ beans >