标签:
数据源1
<bean id="dataSource1" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
...
</bean>
<bean id="transactionManager1"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource1" />
</bean>
<!-- 使用annotation定义事务 -->
<tx:annotation-driven transaction-manager="transactionManager1" proxy-target-class="true" />
<bean id="jdbcTemplate1" class="org.springframework.jdbc.core.JdbcTemplate">
<property name="dataSource" ref="dataSource1" />
</bean>
<bean id="commonDao1" class="com.zw.common.CommonDao">
<property name="dataSource" ref="dataSource1" />
</bean>
<bean id="commonService1" class="com.zw.common.CommonService">
<property name=" commonDao" ref=" commonDao1" />
</bean>
数据源2
<bean id="dataSource2" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
...
</bean>
<bean id="transactionManager2"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource2" />
</bean>
<!-- 使用annotation定义事务 -->
<tx:annotation-driven transaction-manager="transactionManager2" proxy-target-class="true" />
<bean id="jdbcTemplate2" class="org.springframework.jdbc.core.JdbcTemplate">
<property name="dataSource" ref="dataSource2" />
</bean>
<bean id="commonDao2" class="com.zw.common.CommonDao">
<property name="dataSource" ref="dataSource2" />
</bean>
<bean id="commonService2" class="com.zw.common.CommonService">
<property name=" commonDao" ref=" commonDao2" />
</bean>
标签:
原文地址:http://www.cnblogs.com/hdsbk/p/4994030.html