此执行切入点表达式如何工作?

问题描述 投票:0回答:1

我从@kriegaex遇到了answer,我无法理解。

我想理解的切入点表达式如下

@Around("execution(* (@MyAnnotation *).*(..)) || execution(@MyAnnotation * *(..))")

据我所知,此表达式将建议使用@MyAnnotation注释的任何类或方法>

reference documentation开始,execution表达式的格式如下:

execution(modifiers-pattern? ret-type-pattern declaring-type-pattern?name-pattern(param-pattern)
            throws-pattern?)

基于此格式,以下表达式

execution(* (@MyAnnotation *).*(..))

可以解释为

ret-type-pattern is * 
declaring-type-pattern is any type with @MyAnnotation
name-pattern is *
param-pattern is ..

@MyAnnotation注释的类建议任何方法调用。如果我错了,请纠正我。

对于此表达式

execution(@MyAnnotation * *(..))

我无法理解modifiers-pattern如何成为@MyAnnotation?这是如何工作的?

我从@kriegaex那​​里得到了一个答案,我无法理解。我试图理解的切入点表达式是以下@Around(“ execution(*(@MyAnnotation *)。*(..))|| ...

spring spring-aop pointcut
1个回答
0
投票

这是一个有趣的问题。有人正在阅读文档,哇! :)

© www.soinside.com 2019 - 2024. All rights reserved.