zoukankan      html  css  js  c++  java
  • 简单的AOP标签

    常用标签

    1.1<aop:config>

    //作用  用于声明aop的配置
    //配置:<aop:config></aop:config>

    1.2 <aop:aspect>

    /*
    作用:
        用于配置切面。
    属性:
        id:给切面提供一个唯一标识。
        ref:引用配置好的通知类bean的id。
    配置:<aop:aspect id="logAdvice" ref="logger">
    
    */

    1.3<aop:pointcut>

    /*
    作用:
        用于配置切入点表达式
    属性:
        expression:用于定义切入点表达式。
        id:用于给切入点表达式提供一个唯一标识。
    配置:<aop:pointcut expression="execution(* cn.itcast.service.impl.*.*(..))" id="pt1"/>
    
    */

    1.4<aop:before>

    /*
    作用:
        用于配置前置通知
    属性:
        method:指定通知中方法的名称。
        pointct:定义切入点表达式
        pointcut-ref:指定切入点表达式的引用
    配置:<aop:before method="beforePrintLog" pointcut-ref="pt1"/>
    */

    1.5<aop:after-returning>

    /*
    作用:
        用于配置后置通知
    属性:
        method:指定通知中方法的名称。
        pointct:定义切入点表达式
        pointcut-ref:指定切入点表达式的引用
    配置:
    <aop:after-returning method="afterReturningPrintLog"  pointcut-ref="pt1"/>
    */

    1.6<aop:after-throwing>

    /*
    作用:
        用于配置异常通知
    属性:
        method:指定通知中方法的名称。
        pointct:定义切入点表达式
        pointcut-ref:指定切入点表达式的引用
    配置:<aop:after-throwing method="afterThrowingPrintLog" pointcut-ref="pt1"/>
    */

    1.7 <aop:after>

    /*
    作用:
        用于配置最终通知
    属性:
        method:指定通知中方法的名称。
        pointct:定义切入点表达式
        pointcut-ref:指定切入点表达式的引用
    配置:<aop:after method="afterPrintLog" pointcut-ref="pt1"/>
    */

    1.8<aop:around>

    /*
    作用:
            用于配置环绕通知
        属性:
            method:指定通知中方法的名称。
            pointct:定义切入点表达式
            pointcut-ref:指定切入点表达式的引用
        配置:<aop:around method="transactionAround" pointcut-ref="pt1"/>
    说明:
            它是spring框架为我们提供的一种可以在代码中手动控制增强代码什么时候执行的方式。
        注意:
            通常情况下,环绕通知都是独立使用的
    */
  • 相关阅读:
    Java之CyclicBarrier使用
    HashMap,LinkedHashMap,TreeMap的区别
    阿里巴巴常考面试题及汇总答案
    HashTable, HashMap,TreeMap区别
    Java集合类详解
    java代码的几个utils,基本可以直接用
    adb控制手机屏幕滑动(批处理)
    在设备上启用 adb 调试,有一个小秘密
    python clickZan
    python控制鼠标键盘
  • 原文地址:https://www.cnblogs.com/myx-ah/p/10089660.html
Copyright © 2011-2022 走看看