zoukankan      html  css  js  c++  java
  • spring 的 切片Aspect 最常用记录方法执行时间

          <- 依赖 !->
          <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-aop</artifactId>
            </dependency>

    /*
    * * */ package com.icil.esolution.aspect; import java.util.Date; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Aspect; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; /** * *@ClassName: TimeAspect * * @Description: * * @Author: Sea * * @Date: 16 Oct 2018 7:18:40 PM */ @Aspect @Component public class TimeAspect { private static Logger logger =LoggerFactory.getLogger(TimeAspect.class); // @Around("execution(* com.sea.web.controller.UserController.*(..))") @Around("execution(* com.sea.haha.controller.*.*(..))") public Object handleControllerMethod(ProceedingJoinPoint pjp) throws Throwable {  long start = System.currentTimeMillis(); Object object = pjp.proceed();  String costTime = (System.currentTimeMillis() - start) + ""; Object[] args = pjp.getArgs(); String methodName = pjp.getSignature().getName(); logger.info("*************** Run the method --> {} params : {} total cost time is {} ms********************",methodName,args,costTime); return object; } }
  • 相关阅读:
    老大叔开博感想
    模板
    Codeforces Round #685 (Div. 2) 题解
    CF830E Perpetual Motion Machine 题解
    THUWC2020游记
    数论
    后缀数组学习笔记
    Codeforces Round #466 (Div. 2)
    博客停写,搬家到www.54kaikai.com
    lda 主题模型--TOPIC MODEL--Gibbslda++结果分析
  • 原文地址:https://www.cnblogs.com/lshan/p/10491211.html
Copyright © 2011-2022 走看看