I have an aspect that currently works to capture all public method executions within my package.
I would like to modify that to exclude both setters and getters, so I tried that and these are the variants I tried:
This one works, but does obviously does not do anything for setters or getters.
@Around("execution(public * *(..)) && !within(com.walterjwhite.logging..*)")
This does not compile:
@Around("execution(public * *(..)) && !within(* set*(..))")
This compiles, but doesn't prevent capturing setters/getters:
@Around("execution(public * *(..)) && !execution(* set*(..))")
I also came across this post as a reference, but that didn't work. I get compilation errors when trying to compile the aspect.
How can I exclude getters and setters in aspectJ?
See Question&Answers more detail:os