当前位置: 代码迷 >> 综合 >> Tools-threadLocal设置初始值
  详细解决方案

Tools-threadLocal设置初始值

热度:74   发布时间:2023-10-24 06:27:24.0

Tools-threadLocal设置初始值

继承ThreadLocal 重写initialValue 方法

static  class SubThreadLocal extends  ThreadLocal{@Overrideprotected Object initialValue() {System.out.println("给threadLocal设置初始值");return new SimpleDateFormat("yyyyMMdd");}
}
  相关解决方案