public class TestAop {
@Around("execution(public * com.abc.api.impl..(..))")
public Object method(ProceedingJoinPoint pjp) {
String signature = pjp.getSignature().toShortString();
Stopwatch stopwatch = Stopwatch.createStarted();
try {
return pjp.proceed();
} catch (Throwable ex) {
logger.error(signature + " encountered error.", ex);
throw Throwables.propagate(ex);
} finally {
logger.info("{} processed after {}", signature, stopwatch.stop());
}
}
}
### spring-beans/abc-service.xml
` <aop:aspectj-autoproxy />`
网友评论