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框架为我们提供的一种可以在代码中手动控制增强代码什么时候执行的方式。
        注意:
            通常情况下,环绕通知都是独立使用的
    */
  • 相关阅读:
    谷歌Cartographer ROS初探
    在Ubuntu14.04_ROS_indigo上安装Kinect2驱动和bridge
    Turtlebot入门篇
    关于CV、SLAM、机器人导航的碎碎念
    C#与C++的区别!
    ++i 与 i++
    "+" 是怎样连接字符串的?
    不要重复你自己
    实习第四天
    微信小程序添加外部地图服务数据
  • 原文地址:https://www.cnblogs.com/myx-ah/p/10089660.html
Copyright © 2011-2022 走看看