Преглед на файлове

接口返回后删除threadLocal

yanguofeng преди 2 години
родител
ревизия
2bfaecc711
променени са 1 файла, в които са добавени 7 реда и са изтрити 0 реда
  1. 7 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/interceptor/TokenInterceptor.java

+ 7 - 0
adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/interceptor/TokenInterceptor.java

@@ -8,6 +8,7 @@ import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
+import org.springframework.web.servlet.ModelAndView;
 import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
 
 import javax.servlet.http.HttpServletRequest;
@@ -36,4 +37,10 @@ public class TokenInterceptor extends HandlerInterceptorAdapter {
         }
         return super.preHandle(request, response, handler);
     }
+
+    @Override
+    public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
+        bossAuthUserThreadLocal.remove();
+        super.postHandle(request, response, handler, modelAndView);
+    }
 }