Is there a way to get Spring AOP to recognize the value of an argument that has been annotated? (There is no guarantee in the order of the arguments passed into the aspect, so I'm hoping to use an annotation to mark the parameter that needs to be used to process the aspect)
Any alternative approaches would also be extremely helpful.
@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) { }