I ams using Spring 2.5.6, asm 1.5.3, aspectjrt/aspectjweaver 1.6.1, cglib 2.1_3 In my Web based Spring application I have following class:
package uk.co.txttools
I'm not sure if I did it properly but for me what solved it was adding @Component
to the "Aspect'ed" class -
@Aspect
@Component
public class PerformanceLogger {
private Logger logger = LoggerFactory.getLogger(this.getClass());
@Around("within(com.something.rest.service..*)")
public Object doBasicProfiling(ProceedingJoinPoint pjp) throws Throwable {
long start = System.currentTimeMillis();
Object retVal = pjp.proceed();
long end = System.currentTimeMillis();
logger.debug(pjp.getSignature().toShortString() + " Finish: " + (end - start) + "ms");
return retVal;
}
}
(And just to close the loop - if you are using annotation based, don't forget adding @EnableAspectJAutoProxy
to your Config class.
@EnableAspectJAutoProxy