空间站

北极心空

  BlogJava :: 首页 :: 联系 :: 聚合  :: 管理
  15 Posts :: 393 Stories :: 160 Comments :: 0 Trackbacks
     系统中有多个service,但我们的事务策略大部分都是每个service都要写一个代理配置.多个service用同样的事务策略时,简化这样的配置可以用一下方法.
xml代码: 


<!-- 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="*">PROPAGATION_REQUIRED</prop>
            </props>
        </property>
    </bean>

    <bean id="itemService" parent="baseTxProxy">
        <property name="target">
            <bean class="ItemServiceImpl" autowire="byName"/>
        </property>
    </bean>



Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=245954

posted on 2007-08-06 10:59 芦苇 阅读(376) 评论(0)  编辑  收藏 所属分类: Spring

只有注册用户登录后才能发表评论。


网站导航: