Closed
Description
Affects: \5.2.5
Enhancement
- There is a method
Jackson2ObjectMapperBuilder.serializationInclusion(JsonInclude.Include serializationInclusion)
which is an equivalent to Jackson'sObjectMapper setSerializationInclusion(JsonInclude.Include incl)
- Unfortunately there is no equivalent to
ObjectMapper.setPropertyInclusion(JsonInclude.Value incl)
which allows more elaborate configuration.
Suggestion #1
- Replace (or add)
Jackson2ObjectMapperBuilder.serializationInclusion(JsonInclude.Include serializationInclusion)
withJackson2ObjectMapperBuilder.serializationInclusion(JsonInclude.Value serializationInclusion)
which covers more cases.
Suggestion #2
- Add an object mapper post-processor to
Jackson2ObjectMapperBuilder
which would allow to perform exotic configurations not supported by builder by default. - This would remove the need of extending builder class which comes handy in Spring Boot applications.
//example
class Jackson2ObjectMapperBuilder {
private Consumer<ObjectMapper> postProcessor;
public void configure(ObjectMapper objectMapper) {
// ...
if (postProcessor != null) {
postProcessor.accept(objectMapper);
}
}