When adding the @Monitored annotation to a method of a class that is advised by another aspect (e.g., @Transactional), counts are doubled.
The problem is caused by not only the original class is advised; but also the cglib generated proxy is as well.
I modified the MonitoredMeasuringPointcut to include a check for the target class being a cglib proxy.
Here is the modified method of the MonitoredMethodMatcher enum:
@Override
public boolean matches(Method method, Class targetClass) {
return ((!ClassUtils.isCglibProxyClass(targetClass)) && ((AnnotationUtils.findAnnotation(targetClass, Monitored.class) != null) || (AnnotationUtils
.findAnnotation(AopUtils.getMostSpecificMethod(method, targetClass), Monitored.class) != null)));
}
: