SprintBoot 使用 HandlerInterceptor + ThreadLocal 请求拦截获取用户信息

  • Post author:
  • Post category:其他




一、相关依赖

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
</dependency>



二、自定义 ThreadLocal

/**
 * 用户信息
 *
 * @Author: guanqin_li
 * @Date: 2021-08-02 10:10
 */
@Data
@AllArgsConstructor
public class UserInfo {
   
    private Long id;
    private String name;
    private 



版权声明:本文为u010663021原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。