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;
    }
}

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-05-01
  • 2022-12-23
  • 2022-01-11
  • 2021-04-15
  • 2021-08-14
猜你喜欢
  • 2022-01-26
  • 2022-12-23
  • 2021-11-16
  • 2022-01-23
  • 2022-01-25
  • 2021-11-30
  • 2021-11-30
相关资源
相似解决方案