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框架为我们提供的一种可以在代码中手动控制增强代码什么时候执行的方式。
        注意:
            通常情况下,环绕通知都是独立使用的
    */
  • 相关阅读:
    Jmeter压力测试-结果分析(三十)
    C#正则密码验证
    Docker
    c# framework 缓存依赖
    NETMQ订阅,超时断线重连
    RabbitMQ发布/订阅模式
    RAS非对称加密解密,公钥私钥
    .NETCore批量插入数据BulkLoader
    .NETcore使用CSRedisCore操作Redis
    Rabbitmq简单队列
  • 原文地址:https://www.cnblogs.com/myx-ah/p/10089660.html
Copyright © 2011-2022 走看看