<?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:http-conf="http://cxf.apache.org/transports/http/configuration"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xsi:schemaLocation="
http://cxf.apache.org/transports/http/configuration
http://cxf.apache.org/schemas/configuration/http-conf.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxws
http://cxf.apache.org/schemas/jaxws.xsd">
<!--
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName">
<value>oracle.jdbc.driver.OracleDriver</value>
</property>
<property name="url">
<value>jdbc:oracle:thin:@192.168.6.6:1521:ora10</value>
</property>
<property name="username">
<value>learn</value>
</property>
<property name="password">
<value>learn</value>
</property>
</bean>
-->
<!-- 定义使用C3p0连接池的数据源
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
<property name="driverClass">
<value>oracle.jdbc.driver.OracleDriver</value>
</property>
<property name="jdbcUrl">
<value>jdbc:oracle:thin:@192.168.6.6:1521:ora10</value>
</property>
<property name="user">
<value>learn</value>
</property>
<property name="password">
<value>learn</value>
</property>
<property name="maxPoolSize">
<value>3</value>
</property>
<property name="minPoolSize">
<value>2</value>
</property>
<property name="initialPoolSize">
<value>2</value>
</property>
<property name="maxIdleTime">
<value>20</value>
</property>
<property name="acquireIncrement">
<value>2</value>
</property>
<property name="checkoutTimeout">
<value>3000</value>
</property>
<property name="acquireRetryAttempts">
<value>0</value>
</property>
<property name="idleConnectionTestPeriod">
<value>60</value>
</property>
</bean>-->
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
<property name="driverClass">
<value>oracle.jdbc.driver.OracleDriver</value>
</property>
<property name="jdbcUrl">
<value>jdbc:oracle:thin:@192.168.6.6:1521:ora10</value>
</property>
<property name="properties">
<props><!--
<prop key="hibernate.hbm2ddl.auto">update </prop> -->
<prop key="c3p0.minPoolSize">1</prop>
<prop key="hc3p0.maxPoolSize">2</prop>
<prop key="hc3p0.timeout">2</prop>
<prop key="c3p0.max_statement">50</prop>
<prop key="c3p0.testConnectionOnCheckout">true</prop>
<prop key="testConnectionOnCheckin">true</prop>
<prop key="c3p0.testConnectionOnCheckout">true</prop>
<prop key="c3p0.testConnectionOnCheckin">true</prop>
<prop key="checkoutTimeout">3000</prop>
<!--
<prop key="preferredTestQuery">SELECT 1 </prop>
<prop key="hibernate.c3p0.idle_test_period">60</prop>-->
<prop key="user">learn</prop>
<prop key="password">learn</prop>
</props>
</property>
</bean>
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="mappingResources">
<list>
<value>/com/t/cvslog2db/entity/CvsFile.hbm.xml</value>
<value>/com/t/cvslog2db/entity/CvsFileRevisions.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.format_sql">false</prop>
<prop key="hibernate.generate_statistics">false</prop>
<prop key="hibernate.jdbc.batch_size">50</prop>
<prop key="hibernate.c3p0.validate">true</prop>
<prop key="hibernate.c3p0.timeout">10</prop>
</props>
</property>
</bean>
<!--定义Hibernate的事务管理器HibernateTransactionManager -->
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<!-- 依赖注入上面定义的sessionFactory -->
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<!--定义Spring的事务拦截器TransactionInterceptor -->
<bean id="transactionInterceptor" class="org.springframework.transaction.interceptor.TransactionInterceptor">
<!-- 依赖注入上面定义的事务管理器transactionManager -->
<property name="transactionManager" ref="transactionManager"/>
<!-- 定义需要进行事务拦截的方法及所采用的事务控制类型 -->
<property name="transactionAttributes">
<props>
<!-- 以browse、list、load、get及is开头的所有方法采用只读型事务控制类型
<prop key="browse*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="list*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="load*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="is*">PROPAGATION_REQUIRED,readOnly</prop> -->
<!-- 所有方法均进行事务控制,如果当前没有事务,则新建一个事务 -->
<prop key="*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>
<!-- 定义BeanNameAutoProxyCreatorf进行Spring的事务处理-->
<bean class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
<!-- 针对指定的bean自动生成业务代理 -->
<property name="beanNames">
<list>
<value>cvsFileDao</value>
<value>cvsFileRevisionsDao</value>
</list>
</property>
<!-- 这个属性为true时,表示被代理的是目标类本身而不是目标类的接口 -->
<property name="proxyTargetClass">
<value>true</value>
</property>
<!-- 依赖注入上面定义的事务拦截器transactionInterceptor -->
<property name="interceptorNames">
<list>
<value>transactionInterceptor</value>
</list>
</property>
</bean>
<bean id="cvsFileDao" class="com.t.cvslog2db.DAO.CvsFileDao">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<bean id="cvsFileRevisionsDao" class="com.t.cvslog2db.DAO.CvsFileRevisionsDao">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<bean id="importService" class="com.t.cvslog2db.ImportService">
<property name="cvsFileDao" ref="cvsFileDao"/>
<property name="cvsFileRevisionsDao" ref="cvsFileRevisionsDao"/>
</bean>
</beans>