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...
In Spring AOP, a join point always represents a method execution. A pointcut is a predicate that matches the join points, and the pointcut expression language is a way of describing pointcuts programmatically.
A Joinpoint is a point in the control flow of a program where the control flow can arrive via two different paths(IMO : that's why call joint). A Pointcut is a matching Pattern of Joinpoint i.e. set of join points.
Pointcut: Pointcut is expressions that are matched with join points to determine whether advice needs to be executed or not. Pointcut uses different kinds of expressions that are matched with the join points and Spring framework uses the AspectJ pointcut expression language.
AspectJ provides primitive pointcuts that capture join points at these times. These pointcuts use the dynamic types of their objects to pick out join points. They may also be used to expose the objects used for discrimination. this(Type or Id) target(Type or Id)
In this statement:
@Before(value = "@annotation(Action)")
You should replace Action
with auditable
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With