Spring AOP的接口耗时统计
/**
* 通知
*
* @author wwl
*
*/
public class ActionAdvice implements MethodInterceptor {
private Log log=LogFactory.getLog(ActionAdvice.class);
@Override
public Object invoke(MethodInvocation invocation) throws Throwable {
Long startTime;
Long endTime;
startTime=System.currentTimeMillis();
Object o=invocation.proceed();
endTime=System.currentTimeMillis();
log.info("Time["+invocation.getMethod().getDeclaringClass().getSimpleName()+"]["+invocation.getMethod().getName()+"]["+(endTime-startTime)+"]");
return o;
}
}