ObjectUtils { public static void cleanMapOrCollectionField(final Object bean) { ReflectionUtils.doWithFields(bean.getClass(), new ReflectionUtils.FieldCallback() { @Override public void doWith(Field field) throws IllegalArgumentException, IllegalAccessException { field.setAccessible(true); if (field.isAnnotationPresent(NacosIgnore.class)) { return; } Class<?> type = field.getType(); if (Map.class.isAssignableFrom(type) || Collection.class.isAssignableFrom(type)) { field.set(bean, null); } } }); } private  ObjectUtils(); static void cleanMapOrCollectionField(final Object bean); static Object convertIfNecessary(ConfigurableListableBeanFactory beanFactory,
			Field field, Object value); static Object convertIfNecessary(ConfigurableListableBeanFactory beanFactory,
			Method method, Object value);  }
@Test public void test_map_clean() { TestObj obj = new TestObj(); Map<String, Object> map = new HashMap<String, Object>(); map.put("key", "value"); obj.setMap(map); Assert.assertNotNull(map.get("key")); Assert.assertNotNull(obj.map); ObjectUtils.cleanMapOrCollectionField(obj); map = obj.map; Assert.assertNull(map); }