springboot中server.tomcat.min-spare-threads中的默认值为10,如果你没有clear(),那么每十个请求后 你就会拿到原来的线程以及存储在线程中的变量。
threadLocal.get().clear();
threadLocal.get().put("precision", precision);
ThreadLocal的remove()方法会先将Entry中对key的弱引用断开,设置为null,然后再清除对应的key为null的value。
threadLocal.remove();