zoukankan      html  css  js  c++  java
  • Pointcut注解表达式@target、@annotation、@within、this、target、within等

    至于最常见的 execution表达式;由于网上一搜基本都是用的这个,这里就不在赘述了;这里将我知道的分享给大家;

    //@Around("@annotation(自定义注解)")//自定义注解标注在方法上的方法执行aop方法
    如:@Around("@annotation(org.springframework.transaction.annotation.Transactional)")
    
    //@Around("@within(自定义注解)")//自定义注解标注在的类上;该类的所有方法(不包含子类方法)执行aop方法
    如:@Around("@within(org.springframework.transaction.annotation.Transactional)")
    
    //@Around("within(包名前缀.*)")//com.aop.within包下所有类的所有的方法都会执行(不包含子包) aop方法
    如:@Around("within(com.aop.test.*)")
    
    //@Around("within(包名前缀..*)")//com.aop.within包下所有的方法都会执行(包含子包)aop 方法
    如:@Around("within(com.aop.test..*)")
    
    //@Around("this(java类或接口)")//实现了该接口的类、继承该类、该类本身的类---的所有方法(包括不是接口定义的方法,但不包含父类的方法)都会执行aop方法
    如:@Around("this(com.aop.service.TestService)")
    
    //@Around("target(java类或接口)")//实现了该接口的类、继承该类、该类本身的类---的所有方法(包括不是接口定义的方法,包含父类的方法)
    如:@Around("this(com.aop.service.TestService)")
    
    //@Around("@target(自定义注解)")//springboot项目启动报如下错误,没有解决
    // Caused by: java.lang.IllegalStateException:
    // StandardEngine[Tomcat].StandardHost[localhost].TomcatEmbeddedContext[] failed to start
  • 相关阅读:
    路飞学城Python-Day4(practise)
    事件绑定和普通事件的区别
    数组中shift(),push(),unshift(),pop()方法
    IE6中常见BUG与相应的解决办法
    apply()与call()的区别
    CSS引入的方式有哪些? link和@import的区别是?
    substring() , slice() and substr()方法
    webpack常用命令总结
    webpack
    从输入URL 到页面加载完成的过程
  • 原文地址:https://www.cnblogs.com/linliquan/p/15674773.html
Copyright © 2011-2022 走看看