clean ThreadLocal

This commit is contained in:
jay1991115@126.com 2018-12-14 18:32:07 +08:00
parent 564b7d64f3
commit 09f2d222bf
2 changed files with 10 additions and 0 deletions

View File

@ -76,6 +76,12 @@ public class AccessInterceptor extends HandlerInterceptorAdapter{
return true;
}
@Override
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
super.afterCompletion(request, response, handler, ex);
UserContext.removeUser();
}
private void render(HttpServletResponse response, ResultStatus cm)throws Exception {
response.setContentType("application/json;charset=UTF-8");
OutputStream out = response.getOutputStream();

View File

@ -14,4 +14,8 @@ public class UserContext {
return userHolder.get();
}
public static void removeUser() {
userHolder.remove();
}
}