| 1234567891011121314151617181920212223242526272829303132333435363738 |
- <?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:tx="http://www.springframework.org/schema/tx"
- xmlns:aop="http://www.springframework.org/schema/aop"
- xmlns:context="http://www.springframework.org/schema/context"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans-3.0.xsd ">
-
- <bean id="dataSource"
- class="cn.sinobest.framework.comm.transcation.AppRoutingDataSource">
- <property name="targetDataSources">
- <map key-type="java.lang.String">
- <entry key="ds" value-ref="dataSource1" /> <!-- 数据源1 -->
- <entry key="ds2" value-ref="dataSource2" /><!-- 数据源2 -->
- </map>
- </property>
- <property name="defaultTargetDataSource" ref="dataSource1" /> <!-- 默认数据源为datasource1 -->
- </bean>
- <bean id="dataSource1" class="org.springframework.jndi.JndiObjectFactoryBean">
- <property name="jndiName"> <value>${jndi.name}</value> </property> <property
- name="resourceRef"> <value>true</value> </property> </bean>
- <bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate" >
- <property name="dataSource" ref="dataSource" />
- </bean>
-
- <bean id="dataSource2" class="org.springframework.jndi.JndiObjectFactoryBean">
- <property name="jndiName">
- <value>${jndi.name2}</value>
- </property>
- <property name="resourceRef">
- <value>true</value>
- </property>
- </bean>
-
- </beans>
|