spring全局事务配置和多数据源配置
spring全局事务配置和多数据源配置
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="propertyConfigurer"
value="${jdbc.driverClassName}" />
<property name="url" value="${jdbc.url}" />
<property name="username" value="${jdbc.username}" />
<property name="password" value="${jdbc.password}" />
<property name="maxActive" value="50" />
<property name="maxIdle" value="30" />
<property name="maxWait" value="1000" />
<property name="testWhileIdle" value="true" />
<property name="timeBetweenEvictionRunsMillis" value="1800" />
<property name="minEvictableIdleTimeMillis" value="1800" />
</bean>
<bean id="dsB" value="${jdbc1.driverClassName}" />
<property name="url" value="${jdbc1.url}" />
<property name="username" value="${jdbc1.username}" />
<property name="password" value="${jdbc1.password}" />
<property name="maxActive" value="50" />
<property name="maxIdle" value="30" />
<property name="maxWait" value="1000" />
<property name="testWhileIdle" value="true" />
<property name="timeBetweenEvictionRunsMillis" value="1800" />
<property name="minEvictableIdleTimeMillis" value="1800" />
</bean>
<bean id="sessionFactory"
ref="dsA" />
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">${hibernate.dialect}</prop>
<prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
<prop key="hibernate.connection.release_mode">${hibernate.connection.release_mode}</prop>
</props>
</property>
</bean>
<bean id="sessionFactoryB"
ref="dsB" />
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">${hibernate1.dialect}</prop>
<prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
<prop key="hibernate.connection.release_mode">${hibernate.connection.release_mode}</prop>
</props>
</property>
</bean>
<bean id="jotm" />
<bean id="txManager"
ref="jotm" />
</bean>
<bean id="baseTransactionProxy"
ref="txManager" />
<property name="transactionAttributes">
<props>
<prop key="find*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="do*">PROPAGATION_REQUIRED,timeout_500,-Exception</prop>
</props>
</property>
</bean>
</beans>