Macros

给我一支烟!请所有烦恼都能过往如云烟!

导航

简化spring中的事务管理配置

<!-- Transactional proxy for the services -->
    <bean id="baseTxProxy" lazy-init="true"  abstract="true" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
        <property name="transactionManager"><ref bean="transactionManager"/></property>
        <property name="transactionAttributes">
            <props> 
                                <prop key="do*">PROPAGATION_REQUIRED</prop>
                                <prop key="find*">PROPAGATION_REQUIRED,readOnly</prop> 
            </props>
        </property>
    </bean>

    <bean id="itemService" parent="baseTxProxy">
        <property name="target">
            <bean class="ItemServiceImpl" autowire="byName"/>
        </property>
    </bean>
这样省事情多了,不用为每个bean都配置事务了.

posted on 2005-11-21 10:23  Macros  阅读(259)  评论(0)    收藏  举报