I have been using AspectJ for a while, and it works great with object area fields containing annotations. I just came across a situation where I want to annotate a method area variable that will work with my pointcut, but I am having problems with it.
Here is the item that I am using. It works fine if my variable is a field for an object, but if I reduce the scope to a method (a variable declared inside the method), then it no longer works, and I don't know why. Let me know what I can do, thanks.
after(final Trigger trigger): set(@Triggereable * *) && args(trigger) { System.out.println("trigger flush"); }
Also, here is an example of what I want to work with. This System.out.println above should fire when a trigger instance is created:
public void foo() { @Triggereable private Trigger trigger = new Trigger(); }
source share