具有多个注释的方法的AspectJ切入点

使用加载时编织,纯AspectJ。

我们有2个@Count@Count注释,以及一些带注释的方法。

 @Time (name="myMethod1Time") @Count (name="myMethod1Count") public void myMethod1(){..}; @Time (name="myMethod2Time") public void myMethod2(){..}; @Count (name="myMethod3Count") public void myMethod3(){..}; 

现在我为myMethod1定义了我自己的方面, myMethod1有多个注释:

 // multiple annotations, not working @Around("@annotation(time) && @annotation(count)) public Object myAspect(Time time, Count count) {..} 

这不起作用。 但是,捕获方法myMethod2可以使用单个注释正常工作:

 // single annotation, is working @Around("@annotation(time)) public Object myAnotherAspect(Time time) {..} 

我想只捕获签名中存在TimeCount注释的方法,我想使用注释值。 谁知道如何实现这一目标?

也许结合2个切入点,如:

 @Around("call(@Time * *(..)) && call(@Count * *(..))");