Reputation: 1703
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...
Upvotes: 9
Views: 15415
Reputation: 151
In this statement:
@Before(value = "@annotation(Action)")
You should replace Action
with auditable
.
Upvotes: 15
Reputation: 702
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...
Upvotes: 10
Reputation: 3512
try reference code
@Before("execution(public String com.captaindebug.audit.controller.*Controller.*(..)) && @annotation(auditAnnotation)")
public void auditScreen(JoinPoint joinPoint,Audit auditAnnotation) {...}
Upvotes: 2