zoukankan      html  css  js  c++  java
  • Spring xml中的tx:advice标签

    官方文档:

    The concept of "advisors" is brought forward from the AOP support defined in Spring and does not have a direct equivalent in AspectJ. An advisor is like a small self-contained aspect that has a single piece of advice. The advice itself is represented by a bean, and must implement one of the advice interfaces described in Advice types in Spring. Advisors can take advantage of AspectJ pointcut expressions though.

    Spring supports the advisor concept with the <aop:advisor> element. You will most commonly see it used in conjunction with transactional advice, which also has its own namespace support in Spring. Here’s how it looks:

    简言之:advisors的概念来至于Spring aop,但是advisor在aspectj中并没有用一个等价概念。advisor类似一个切面。

        <aop:config>
            <aop:advisor id="tx-advisor" advice-ref="tx-advice"
                         pointcut="execution(public * com.javartisan.sf.*.*(*))"/>
        </aop:config>
    
        <tx:advice id="tx-advice" transaction-manager="transactionManager">
            <tx:attributes>
                <tx:method name="save*" propagation="REQUIRED" timeout="20000" isolation="READ_COMMITTED"
                           rollback-for="java.lang.RuntimeException" no-rollback-for="com.javartisan.CustomException"
                           read-only="false"/>
                <tx:method name="del*" propagation="REQUIRED" timeout="20000" isolation="READ_COMMITTED"
                           rollback-for="java.lang.RuntimeException" no-rollback-for="com.javartisan.CustomException"
                           read-only="false"/>
            </tx:attributes>
        </tx:advice>
      
    

      

  • 相关阅读:
    黑白逆向编程课程笔记 8.静&动态地址&偏移
    黑白逆向编程课程笔记 7.CE使用(2)
    黑白逆向编程课程笔记 6.CE使用(1)
    传奇资源
    分布式——分布式发号器
    SpringBoot——属性注入
    SpringBoot——启动与自动配置类查找
    Mybatis——Spring事务实现
    SpringAOP——事务实现
    Linux——IO技术
  • 原文地址:https://www.cnblogs.com/leodaxin/p/12216833.html
Copyright © 2011-2022 走看看