Tools-threadLocal设置初始值
继承ThreadLocal 重写initialValue 方法
static class SubThreadLocal extends ThreadLocal{ @Override protected Object initialValue() { System.out.println("给threadLocal设置初始值"); return new SimpleDateFormat("yyyyMMdd"); } }
Tools-threadLocal设置初始值
继承ThreadLocal 重写initialValue 方法
static class SubThreadLocal extends ThreadLocal{ @Override protected Object initialValue() { System.out.println("给threadLocal设置初始值"); return new SimpleDateFormat("yyyyMMdd"); } }