pjfanning commented on code in PR #2354:
URL: https://github.com/apache/kylin/pull/2354#discussion_r3891479690
##########
src/core-common/src/main/java/org/apache/kylin/common/util/JsonUtil.java:
##########
@@ -60,33 +62,43 @@
public class JsonUtil {
// reuse the object mapper to save memory footprint
- private static final ObjectMapper mapper = new ObjectMapper();
- private static final ObjectMapper indentMapper = new ObjectMapper();
+ private static final ObjectMapper MAPPER = new ObjectMapper();
Review Comment:
The code would be more future proof if you use Jackson's
JsonMapper.builder() to configure the mappers. The APIs are heading this way to
suit Jackson 3 where mappers are immutable.
A simplified example.
```
private static final ObjectMapper MAPPER = JsonMapper.builder()
.addModule(new GuavaModule())
.polymorphicTypeValidator(KYLIN_TYPE_VALIDATOR)
.filterProvider(simpleFilterProvider)
.typeFactory(customTypeFactory)
.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
.build();
```
I'm not sure of all method names on JsonMapper.Builder but this is
approximately what it looks like.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]