update 优化 请求结束清空上下文变量

2.X
疯狂的狮子Li 1 year ago
parent a06832e9f6
commit 2f448f6825

@ -9,7 +9,6 @@ import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import org.dromara.common.core.constant.HttpStatus; import org.dromara.common.core.constant.HttpStatus;
import org.dromara.common.core.context.ThreadLocalHolder; import org.dromara.common.core.context.ThreadLocalHolder;
import org.dromara.common.satoken.utils.LoginHelper;
import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
@ -32,7 +31,7 @@ public class SecurityConfiguration implements WebMvcConfigurer {
registry.addInterceptor(new SaInterceptor() { registry.addInterceptor(new SaInterceptor() {
@Override @Override
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception { public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
ThreadLocalHolder.remove(LoginHelper.LOGIN_USER_KEY); ThreadLocalHolder.clear();
} }
}).addPathPatterns("/**"); }).addPathPatterns("/**");
} }

Loading…
Cancel
Save