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>
  • 相关阅读:
    关于网站的性能瓶颈——(阅读笔记)
    Servlet原理解析
    配置Ubuntu Server高速aptget源
    字节对齐
    linux学习笔记—之—linux文件管理
    JavaWeb过滤器Filter
    C语言编程程序的内存布局
    修改Linux下MySQL编码
    C语言中——关于typedef
    linux学习笔记—之—LVM管理
  • 原文地址:https://www.cnblogs.com/light-zhang/p/9921442.html
Copyright © 2011-2022 走看看