c3p0在spring中的配置

 

  1. <? xml   version = "1.0"   encoding = "UTF-8" ?>   
  2. <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd" >   
  3.   
  4. < beans >   
  5.      < bean   id = "propertyConfigurer"   class = "org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" >   
  6.          < property   name = "locations" >   
  7.              < list >   
  8.                  < value > classpath*:config/jdbc.properties </ value >   
  9.              </ list >   
  10.          </ property >   
  11.      </ bean >   
  12.   
  13.      <!-- ========================= RESOURCE DEFINITIONS ========================= -->   
  14.      < bean   id = "dataSource"   class = "com.mchange.v2.c3p0.ComboPooledDataSource"   destroy-method = "close" >   
  15.          < property   name = "driverClass"   value = "${jdbc.driverClassName}" />   
  16.          < property   name = "jdbcUrl"   value = "${jdbc.url}" />   
  17.          < property   name = "properties" >   
  18.          < props >   
  19.              < prop   key = "c3p0.minPoolSize" > 1 </ prop >     
  20.              < prop   key = "hc3p0.maxPoolSize" > 10 </ prop >     
  21.              < prop   key = "hc3p0.timeout" > 60 </ prop >     
  22.              < prop   key = "c3p0.max_statement" > 50 </ prop >     
  23.              < prop   key = "c3p0.testConnectionOnCheckout" > true </ prop >     
  24.              < prop   key = "hibernate.c3p0.testConnectionOnCheckout" > false </ prop >   
  25.              < prop   key = "user" > ${jdbc.username} </ prop >     
  26.              < prop   key = "password" > ${jdbc.password} </ prop >   
  27.          </ props >   
  28.        </ property >   
  29.      </ bean >   
  30.   
  31.      <!-- Transaction manager for a single JDBC DataSource -->   
  32.      < bean   id = "transactionManager"   class = "org.springframework.jdbc.datasource.DataSourceTransactionManager" >   
  33.          < property   name = "dataSource"   ref = "dataSource" />   
  34.      </ bean >   
  35.   
  36.      <!-- SqlMap setup for iBATIS Database Layer -->   
  37.      < bean   id = "sqlMapClient"   class = "org.springframework.orm.ibatis.SqlMapClientFactoryBean" >   
  38.          < property   name = "configLocation"   value = "classpath:config/sql-map-config.xml" />   
  39.          < property   name = "dataSource"   ref = "dataSource" />   
  40.      </ bean >   
  41.        
  42.      < bean   id = "txProxyTemplate"   class = "org.springframework.transaction.interceptor.TransactionProxyFactoryBean"   
  43.      lazy-init = "true" >        
  44.          < property   name = "transactionManager" > < ref   bean = "transactionManager"   /> </ property >        
  45.          <!--指明事务属性-->      
  46.          < property   name = "transactionAttributes" >        
  47.              < props >        
  48.                  < prop   key = "insert*" > PROPAGATION_REQUIRED </ prop >        
  49.                  < prop   key = "get*" > PROPAGATION_REQUIRED,readOnly </ prop >       
  50.                  < prop   key = "save*" > PROPAGATION_REQUIRED </ prop >   
  51.                  < prop   key = "remove*" > PROPAGATION_REQUIRED </ prop >   
  52.                  < prop   key = "*" > PROPAGATION_REQUIRED,readOnly </ prop >     
  53.              </ props >        
  54.          </ property >        
  55.      </ bean >         
  56.   
  57. </ beans >

 

你可能感兴趣的:(spring,c3p0,user,insert,encoding)