mirror of
https://github.com/chillzhuang/blade-tool
synced 2024-12-12 12:19:27 +08:00
⚡ jackson序列化时支持空字符串转换为null对象
This commit is contained in:
parent
9d7400f381
commit
542413373f
@ -77,6 +77,8 @@ public class JacksonConfiguration {
|
||||
objectMapper.getDeserializationConfig().withoutFeatures(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
|
||||
//日期格式化
|
||||
objectMapper.registerModule(new BladeJavaTimeModule());
|
||||
//允许空字符串序列化为null对象
|
||||
objectMapper.enable(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT);
|
||||
objectMapper.findAndRegisterModules();
|
||||
return objectMapper;
|
||||
}
|
||||
|
@ -976,6 +976,8 @@ public class JsonUtil {
|
||||
super.getDeserializationConfig().withoutFeatures(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
|
||||
//日期格式化
|
||||
super.registerModule(new BladeJavaTimeModule());
|
||||
//允许空字符串序列化为null对象
|
||||
super.enable(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT);
|
||||
super.findAndRegisterModules();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user