I'm trying to understand the difference between execution and call in AOP as simply as possible. From what I gather, execution() will add a join point in the executing code, so HelloWorldSayer.sayHello()
in this case, but if the pointcut was call()
, then the join point will be HelloWorldSayer.main()
. Is this correct?
public class HelloWorldSayer {
public static void main (String[] args) {
sayHello();
}
public static void sayHello() {
System.out.println("Hello");
}
}
public aspect World {
public hello():
execution(static void HelloWorldSayer.sayHello());
after() hello() {
System.out.println("Bye");
}
}