Spring aop, unbound pointcut parameter

Viewed 9191

Im getting this error taht i dont really understand:

unbound pointcut parameter auditable

following code:

@Aspect
public class TestAspect {

    @Before(value = "@annotation(Action)")
    public void audit(JoinPoint joinPoint, Action auditable) {
        System.out.println(auditable);
    }
}

 @Action(ActionType.FAST)
    public static void resolveFast(String name){
        System.out.println(name);
    }

@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface Action {

    ActionType value();
    boolean withArgs() default false;
}

public enum ActionType {
    FAST, SLOW
}

the problem occurs on @Before annotation, these are my first steps in aop...

3 Answers

In this statement:

 @Before(value = "@annotation(Action)")

You should replace Action with auditable.

change the code like this:

    @Before(value = "@annotation(auditable)")
    public void audit(JoinPoint joinPoint, Action auditable) {
        System.out.println(auditable);
    }

You see the different??

Right, @annotation's parameter should be auditable!!!

Ok, right now, I just spent almost 2 hour to debug...

Just this. I feel waste my life, but I really hope save yours...

I still feel bad...

Related