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>
  • 相关阅读:
    javascript的propertyIsEnumerable()方法
    delete删除属性
    浅入javascript正则表达式的规则.
    关于jQuery的$.proxy()应用.
    jQuery的删除的三种方法remove(),detach(),empty()
    我来提出一个问题,大家一起讨论讨论.
    如何采集淘宝最新价格
    C中的正则函数sscanf
    HTTP协议头部与Keep-Alive模式详解
    如何实现HTTPSERVER
  • 原文地址:https://www.cnblogs.com/light-zhang/p/9921442.html
Copyright © 2011-2022 走看看