(note: this is retroactive issue -- actual removal done before 3.0.0-rc1
release)
(note: inspired by #5269)
With 3.0, ObjectMapper
becomes immutable: this is achieved by removing all setXxx()
methods (and other mutators). This includes setSerializationInclusion()
.
The replacement for:
ObjectMapper mapper = new ObjectMapper();
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
is
ObjectMapper mapper = JsonMapper.builder()
.changeDefaultPropertyInclusion(incl -> incl.withValueInclusion(JsonInclude.Include.NON_NULL)
.build();
NOTE: it may make sense to create an umbrella issue for "make ObjectMapper immutable"?