c3p0在spring中的配置

 

    • <? 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 >

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值