I have a Java class which is something like the following:
public class Foo{
public void doSomething(){
StageA a = new StageA();
StageB b = new StageB();
StageC c = new StageC();
a.execute();
b.execute();
c.execute();
}
}
Now, assuming I can’t really edit this class itself, could I still use spring AOP to apply logging around the execute methods? (presumably without using aspect4j)
Yes, you can write an
@Aroundadvice withexecutionpointcut targeting methods whose name isexecute()as follows: