My simple Performance monitor does the following:
Code:
@Component
@Aspect
public class ServicePerformanceCheck {
@Pointcut("execution(* com.mytest.*.*(..))")
public void businessService() {}
@Around("businessService()")
public Object monitor(ProceedingJoinPoint pjp) throws Throwable {
StopWatch clock = new StopWatch(pjp.toShortString());
clock.start();
try {
return pjp.proceed();
} finally {
clock.stop();
System.out.println(clock.prettyPrint());
}
}
}
So what happens is that for the beans declared in XML, the performance monitor does not log the metric. However, if the bean definitions are removed from the XML configuration and we just depend on the @Service tags, the metrics are logged.
So it looks to me like I cannot mix the @Aspect with plain XML configured beans. Is this accurate or am I missing something?