@@ -0,0 +1,2188 @@
+package com.example.aspects;%0A%0A%0Aimport com.example.annotations.AroundLogging;%0Aimport lombok.extern.slf4j.Slf4j;%0Aimport org.aspectj.lang.ProceedingJoinPoint;%0Aimport org.aspectj.lang.Signature;%0Aimport org.aspectj.lang.annotation.Around;%0Aimport org.aspectj.lang.annotation.Aspect;%0Aimport org.aspectj.lang.reflect.MethodSignature;%0Aimport org.springframework.stereotype.Component;%0A%0Aimport java.util.HashMap;%0A%0A/**%0A * Create with IntelliJ IDEA%0A * Author               : wangzhenpeng%0A * Date                 : 2017/4/18%0A * Time                 : 15:31%0A * Description          : %E6%97%A5%E5%BF%97%E5%88%87%E9%9D%A2%E5%A4%84%E7%90%86%E7%B1%BB%0A */%0A@Slf4j%0A@Component%0A@Aspect%0Apublic class LogAspect %7B%0A    /**%0A     * %E6%89%93%E5%8D%B0%E6%97%A5%E5%BF%97%0A     * @param pjp%0A     * @param aroundLogging%0A     * @return%0A     * @throws Throwable%0A     */%0A    @Around(%22@annotation(aroundLogging)%22)%0A    public Object outputLogAndTimeCast(final ProceedingJoinPoint pjp, AroundLogging aroundLogging) throws Throwable %7B%0A        MethodSignature methodSignature = (MethodSignature)pjp.getSignature();%0A        String declaringType = methodSignature.getDeclaringType().getSimpleName();%0A%0A        HashMap%3CString, Object%3E paramsMap = generateParamsMap(pjp);%0A        long start = System.currentTimeMillis();%0A        log.info(%22query step into %5B%7B%7D.%7B%7D%5D, params:%5B%7B%7D%5D%22, declaringType, methodSignature.getMethod().getName(), paramsMap);%0A        Object result = pjp.proceed();%0A        long end = System.currentTimeMillis();%0A        log.info(%22query step out %5B%7B%7D.%7B%7D%5D, return:%5B%7B%7D%5D, time cast:%5B%7B%7D%5Dms%22, declaringType, methodSignature.getMethod().getName(),%0A                result, end - start);%0A        return result;%0A    %7D%0A%0A    /**%0A     * %E6%9E%84%E9%80%A0%E5%85%A5%E5%8F%82map%0A     * @param pjp%0A     * @return%0A     */%0A    private HashMap%3CString, Object%3E generateParamsMap(ProceedingJoinPoint pjp) %7B%0A        Object%5B%5D paramsValue = pjp.getArgs();%0A        Signature signature = pjp.getSignature();%0A        MethodSignature methodSignature = (MethodSignature)signature;%0A        String%5B%5D paramsName = methodSignature.getParameterNames();%0A%0A        HashMap%3CString, Object%3E paramsMap = new HashMap%3C%3E();%0A        for (int i = 0; i %3C paramsName.length; i++) %7B%0A            paramsMap.put(paramsName%5Bi%5D, paramsValue%5Bi%5D);%0A        %7D%0A        return paramsMap;%0A    %7D%0A %7D%0A

print log via aop