Reputation: 610
In my Java application, I want to intercept calls to commands. Every command class has a name that ends with Command
and a method public void run(...)
invoked to execute the command.
I tried @Around("execution(void *.*Command.run(..))")
and various variations, but I can't get it to trigger.
I have other pointcuts in my application that work just fine, so it's not an AspectJ configuration problem.
Upvotes: 0
Views: 105
Reputation: 67297
Probably you have package names like org.company.application.domain
rather than just something
. Your pointcut assumes the latter, though. In order to match against classes no matter how deep their subpackage is nested, you need to use the double dot notation ..
:
@Around("execution(void *..*Command.run(..))")
Upvotes: 1