zoukankan      html  css  js  c++  java
  • 多数据源配置

    数据源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>

  • 相关阅读:
    C++学习 之 程序的组成部分(部分知识笔记)
    debian下重装mysql
    CGI 环境变量
    boost的libboost_system问题
    debian下使用shell脚本时出现了 declare:not found 解决方法
    编译的时候出现"/usr/bin/ld: cannot find -lz
    glibc升级,解决glib版本过低的问题
    ubuntu彩色图形界面
    (转)http://blog.chinaunix.net/uid-8363656-id-2031644.html CGI 编写
    linux安装JSONCPP
  • 原文地址:https://www.cnblogs.com/hdsbk/p/4994030.html
Copyright © 2011-2022 走看看