如何在aspectJ中排除getter和setter?

我在我的maven项目中有一个类aspectJ,它让我在项目中显示任何被调用方法的Begin和End。 我现在尝试排除所有的getter和setter。 我尝试修改这个注释: @Around("execution(public * *(..)) by @Around("execution(public * *(..) && !within(* set*(..))")

但它没有whork,它给了我在consol:

  [ERROR] Failed to execute goal org.codehaus.mojo:aspectj-maven-plugin:1.7:compile (default) on project spb-lceb: AJC compiler errors: [ERROR] error at @Around("execution(public * *(..) && !within(* set*(..))") Syntax error on token "execution(public * *(..) && !within(* set*(..))", ")" expected 

任何的想法

我认为这只是一个错字,因为你在&&运算符之前的执行调用结束时有一个mising )

 @Around("execution(public * *(..) && !within(* set*(..))") 

应该:

 @Around("execution(public * *(..)) && !within(* set*(..))") 

尝试一下,应该做的伎俩。

对于以获取最佳解决方案开头的方法,重命名它们以摆脱这种冲突。

接受的解决方案显然是错误的,因为within(* set*(..))内甚至不会编译。 此切入点类型需要类型签名,而不是方法签名。 此外,它只是试图照顾制定者,而不是OP所要求的吸气剂。

正确的解决方案是:

 @Around("execution(public * *(..)) && !execution(* set*(..)) && !execution(* get*(..))") 

通过接受错误的解决方案OP甚至激怒了其他尝试的人。 这就是为什么经过这么长时间我写这个答案。