From 8d3d93e537d2b1440463c6fb3038bb30a3dc158f Mon Sep 17 00:00:00 2001
From: dhb52 <dhb52@126.com>
Date: 星期二, 02 一月 2024 23:15:08 +0800
Subject: [PATCH] perf: 减少powerjob不必要的代理路径

---
 ruoyi-common/ruoyi-common-security/src/main/java/org/dromara/common/security/config/SecurityConfig.java |   22 ++++++++++------------
 1 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/ruoyi-common/ruoyi-common-security/src/main/java/org/dromara/common/security/config/SecurityConfig.java b/ruoyi-common/ruoyi-common-security/src/main/java/org/dromara/common/security/config/SecurityConfig.java
index ace0668..211cefa 100644
--- a/ruoyi-common/ruoyi-common-security/src/main/java/org/dromara/common/security/config/SecurityConfig.java
+++ b/ruoyi-common/ruoyi-common-security/src/main/java/org/dromara/common/security/config/SecurityConfig.java
@@ -4,17 +4,14 @@
 import cn.dev33.satoken.interceptor.SaInterceptor;
 import cn.dev33.satoken.router.SaRouter;
 import cn.dev33.satoken.stp.StpUtil;
-import jakarta.servlet.http.HttpServletRequest;
-import jakarta.servlet.http.HttpServletResponse;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
 import org.dromara.common.core.utils.ServletUtils;
 import org.dromara.common.core.utils.SpringUtils;
 import org.dromara.common.core.utils.StringUtils;
 import org.dromara.common.satoken.utils.LoginHelper;
-import org.dromara.common.core.context.ThreadLocalHolder;
 import org.dromara.common.security.config.properties.SecurityProperties;
 import org.dromara.common.security.handler.AllUrlHandler;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
 import org.springframework.boot.autoconfigure.AutoConfiguration;
 import org.springframework.boot.context.properties.EnableConfigurationProperties;
 import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
@@ -63,7 +60,7 @@
                         }
 
                         // 淇濆瓨鐢ㄦ埛淇℃伅
-                        ThreadLocalHolder.set(LoginHelper.LOGIN_USER_KEY, LoginHelper.getLoginUser());
+//                        ThreadLocalHolder.set(LoginHelper.LOGIN_USER_KEY, LoginHelper.getLoginUser());
 
                         // 鏈夋晥鐜囧奖鍝� 鐢ㄤ簬涓存椂娴嬭瘯
                         // if (log.isDebugEnabled()) {
@@ -73,12 +70,13 @@
 
                     });
             })
-            {
-                @Override
-                public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
-                    ThreadLocalHolder.remove(LoginHelper.LOGIN_USER_KEY);
-                }
-            }).addPathPatterns("/**")
+//            {
+//                @Override
+//                public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
+//                    ThreadLocalHolder.clear();
+//                }
+//            }
+            ).addPathPatterns("/**")
             // 鎺掗櫎涓嶉渶瑕佹嫤鎴殑璺緞
             .excludePathPatterns(securityProperties.getExcludes());
     }

--
Gitblit v1.9.3