首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

spring大局事务配置和多数据源配置

2013-11-15 
spring全局事务配置和多数据源配置spring全局事务配置和多数据源配置?xml version1.0 encodingUTF-8

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>

热点排行