首页 > 学院 > 开发设计 > 正文

spring 2.0 的事务自动处理

2019-11-17 06:04:22
字体:
来源:转载
供稿:网友
 <aop:config>
        <!--<aop:advisor id="userManagerTx" advice-ref="userManagerTxAdvice" pointcut="execution(* *..service.UserManager.*(..))" order="0"/>-->       
        <!--<aop:advisor id="userManagerSecurity" advice-ref="userSecurityAdvice" pointcut="execution(* *..service.UserManager.saveUser(..))" order="1"/>-->
        <aop:advisor id="managerTx" advice-ref="txAdvice" pointcut="execution(* *..service.*Manager.*(..)) execution(* *..service.*Service.*(..))" order="0"/>
    </aop:config>
   
    <tx:advice id="txAdvice">
        <tx:attributes>
            <tx:method name="get*" PRopagation="SUPPORTS" read-only="true"/>
            <tx:method name="save*" propagation="REQUIRED"/>
            <tx:method name="update*" propagation="REQUIRED"/>
            <tx:method name="remove*" propagation="REQUIRED"/>
            <tx:method name="*" propagation="SUPPORTS"/>
        </tx:attributes>
    </tx:advice>

 <!-- Transaction manager for a single JDBC DataSource -->
    <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
        <property name="dataSource" ref="dataSource"/>
    </bean>

进入讨论组讨论。


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表