V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
yustation
V2EX  ›  Java

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

  •  
  •   yustation · Sep 7, 2023 · 1416 views
    This topic created in 972 days ago, the information mentioned may be changed or developed.

    看若依的源码,发现日志切面类 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  
       Sep 7, 2023   ❤️ 1
    你说的是不使用 @ Pointcut 注解吗
    yustation
        3
    yustation  
    OP
       Sep 7, 2023
    @sheeta 感谢大佬
    yustation
        4
    yustation  
    OP
       Sep 7, 2023
    @zjp 不是,是对这个切点表达式的写法有疑惑,一楼的大佬完美解答了,谢谢回复
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3449 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 36ms · UTC 12:07 · PVG 20:07 · LAX 05:07 · JFK 08:07
    ♥ Do have faith in what you're doing.