ThreadLocal 同一个线程内共享数据

 

public static ThreadLocal toThreadLocal = new ThreadLocal<>();

// 赋值

toThreadLocal.set(userInfoTo);

// 取值

UserInfoTo userInfoTo = CartInterceptor.toThreadLocal.get();

 

 

posted @ 2021-11-22 14:59  cookieM  阅读(85)  评论(0)    收藏  举报