From 8510a58e9022e7cca3a3ac9f9de2b235cba86a36 Mon Sep 17 00:00:00 2001 From: xiangwbs Date: Sun, 26 Nov 2017 21:17:29 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=97=A5=E5=BF=97=E5=88=87?= =?UTF-8?q?=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/xwbing/handler/WebLogAspect.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/boot-web/src/main/java/com/xwbing/handler/WebLogAspect.java b/boot-web/src/main/java/com/xwbing/handler/WebLogAspect.java index 64cfd56..426f819 100644 --- a/boot-web/src/main/java/com/xwbing/handler/WebLogAspect.java +++ b/boot-web/src/main/java/com/xwbing/handler/WebLogAspect.java @@ -23,7 +23,7 @@ import java.lang.reflect.Method; @Component public class WebLogAspect { private final Logger logger = LoggerFactory.getLogger(WebLogAspect.class); - private ThreadLocal startTime = new ThreadLocal<>(); + private final ThreadLocal startTime = new ThreadLocal<>(); @Pointcut("within(com.xwbing.controller..*) && @annotation(logInfo)") public void pointCutWithMsg(LogInfo logInfo) { @@ -38,7 +38,7 @@ public class WebLogAspect { * * @param logInfo */ - @Before("pointCutWithMsg(logInfo)") + @Before(value = "pointCutWithMsg(logInfo)", argNames = "joinPoint,logInfo") public void before(JoinPoint joinPoint, LogInfo logInfo) { startTime.set(System.currentTimeMillis()); String info = logInfo.value(); @@ -52,7 +52,7 @@ public class WebLogAspect { * * @param logInfo */ - @AfterReturning(pointcut = "pointCutWithMsg(logInfo)") + @AfterReturning(pointcut = "pointCutWithMsg(logInfo)", argNames = "joinPoint,logInfo") public void afterReturning(JoinPoint joinPoint, LogInfo logInfo) { long end = System.currentTimeMillis(); long ms = end - startTime.get(); @@ -110,8 +110,8 @@ public class WebLogAspect { String description = ""; for (Method method : methods) { if (method.getName().equals(methodName)) { - Class[] clazzs = method.getParameterTypes(); - if (clazzs.length == arguments.length) { + Class[] classes = method.getParameterTypes(); + if (classes.length == arguments.length) { description = method.getAnnotation(LogInfo.class).value(); break; }