zoukankan      html  css  js  c++  java
  • spring 事务AOP配置管理

      <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
            <property name="dataSource" ref="dataSource" />
        </bean>
        <!-- 声明使用注解式事务 -->
        <tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="true" />
        
        <!-- 配置事务通知 -->
        <tx:advice id="txAdvice"     transaction-manager="transactionManager">
            <tx:attributes>
                <!-- get find 读操作 -->
                <tx:method name="get*" isolation="DEFAULT" propagation="SUPPORTS" rollback-for="Exception" read-only="true" />
                <tx:method name="find*" isolation="DEFAULT" propagation="SUPPORTS" rollback-for="Exception" read-only="true" />
                <tx:method name="count*" isolation="DEFAULT" propagation="SUPPORTS" rollback-for="Exception" read-only="true" />
                <!-- create delete update 写操作 -->
                <tx:method name="create*" isolation="REPEATABLE_READ" propagation="REQUIRED" rollback-for="Exception" read-only="false" />
                <tx:method name="delete*" isolation="REPEATABLE_READ" propagation="REQUIRED" rollback-for="Exception" read-only="false" />
                <tx:method name="update*" isolation="REPEATABLE_READ" propagation="REQUIRED" rollback-for="Exception" read-only="false" />
            </tx:attributes>
        </tx:advice>
        <!-- 配置织入 -->
        <aop:config>
            <!-- 配置切点表达式 -->
            <aop:pointcut id="txAdvicePointcut" expression="execution(* com.cats.services.*.impl..*(..))" />
            <!-- 配置切面 : 通知+切点 advice-ref:通知的名称 pointcut-ref:切点的名称 -->
            <aop:advisor advice-ref="txAdvice" pointcut-ref="txAdvicePointcut" />
        </aop:config>
  • 相关阅读:
    分布式一致性模型
    ubuntu18.04 基于Hadoop3.1.2集群的Hbase2.0.6集群搭建
    ubuntu18.04 flink-1.9.0 Standalone集群搭建
    Idea 打印GC
    goroutine简介
    MESI缓存一致性协议
    Spark RDD 算子总结
    SparkStreaming 笔记
    Spark 内存管理
    Highcharts(数据分析图)
  • 原文地址:https://www.cnblogs.com/light-zhang/p/9921442.html
Copyright © 2011-2022 走看看