注釈付きの引数の値をSpring AOPに認識させる方法はありますか? (アスペクトに渡された引数の順番での保証はないので、アスペクトを処理するために使用する必要があるパラメータをマークするために注釈を使用したいと考えています)。メソッドとパラメータアノテーションを使用するSpring AOP
役に立った
@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface Wrappable {
}
@Target({ElementType.PARAMETER})
@Retention(RetentionPolicy.RUNTIME)
public @interface Key {
}
@Wrappable
public void doSomething(Object a, @Key Object b) {
// something
}
@Aspect
@Component
public class MyAspect {
@After("@annotation(trigger)" /* what can be done to get the value of the parameter that has been annotated with @Key */)
public void trigger(JoinPoint joinPoint, Trigger trigger) { }