i have two aspects, one for acquiring a lock @Around a call, another one for debouncing method calls. the aspects look like this:
@Pointcut("execution(public * * (..))")
private void anyPublicMethod() {}
@Around("anyPublicMethod() && @annotation(lock)")
public Object all(ProceedingJoinPoint proceedingJoinPoint, Lock lock) throws Throwable {
// acquire lock, then proceed()
}
and the other one looks like this:
@Pointcut("execution(public * * (..))")
private void anyPublicMethod() {}
@Around("anyPublicMethod() && @annotation(debounce)")
public Object all(ProceedingJoinPoint proceedingJoinPoint, Debounce debounce) throws Throwable {
// debouncing as described in
// http://stackoverflow.com/questions/4742210/implementing-debounce-in-java
}
the full code:
and
when i put both my @Debounce and my @Lock on a method, i get this exception:
Required to bind 2 arguments, but only bound 1 (JoinPointMatch was NOT bound in invocation)
at org.springframework.aop.aspectj.AbstractAspectJAdvice.argBinding(AbstractAspectJAdvice.java:584)
at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610)
at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:68)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:168)
at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:85)
it seems to be related to spring aop not being able to figure out the next thing to call in line is another aspect, not the actual target, and i have seen other reports from spring aop 2 and 3 ... but i am using:
spring 4.1.1.RELEASE