ThreadLocalContextHolder { public static void put(String key, Object payload) { Map<String, Object> context = THREAD_WITH_CONTEXT.get(); if (context == null) { context = new HashMap<>(); THREAD_WITH_CONTEXT.set(context); } if(null == payload) { if(context.containsKey(key)) { context.remove(key); } } else { context.put(key, payload); } } ThreadLocalContextHolder(); static void put(String key, Object payload); static Object get(String key); static void cleanupThread();  }
@Test public void testPut() { System.out.println("put"); ThreadLocalContextHolder.put(KEY, VALUE); Object result = ThreadLocalContextHolder.get(KEY); assertThat(result).isEqualTo(VALUE); }