V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
yustation
V2EX  ›  Java

关于切点表达式中 @annotation 用法的疑问

  •  
  •   yustation · 233 天前 · 570 次点击
    这是一个创建于 233 天前的主题,其中的信息可能已经有所发展或是发生改变。

    看若依的源码,发现日志切面类 com.ruoyi.framework.aspectj.LogAspect 中编写切面表达式使用了这种我前所未见的方式

    @Before(value = "@annotation(controllerLog)")
        public void boBefore(JoinPoint joinPoint, Log controllerLog)
        {
            TIME_THREADLOCAL.set(System.currentTimeMillis());
        }
    

    查网上的博客只发现了 @annotation(xxx.xxx.注解类名)这种用法,这里这样写为什么同样能匹配到使用了 Log 注解的连接点呢?恳请各位大佬们解答一下,如能给官方文档说明的具体位置再好不过了

    zjp
        2
    zjp  
       233 天前   ❤️ 1
    你说的是不使用 @ Pointcut 注解吗
    yustation
        3
    yustation  
    OP
       233 天前
    @sheeta 感谢大佬
    yustation
        4
    yustation  
    OP
       233 天前
    @zjp 不是,是对这个切点表达式的写法有疑惑,一楼的大佬完美解答了,谢谢回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   898 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 20:09 · PVG 04:09 · LAX 13:09 · JFK 16:09
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.