I have a POJO with lombok annotations which my JSON deserializes to through Jackson like so:
@Getter
@ToString
@NoArgsConstructor
@Builder
@AllArgsConstructor
@EqualsAndHashCode
@JsonIgnoreProperties(ignoreUnknown = true)
public class ResponsePOJO {
@JsonProperty("list-one")
private List<Object> list1 = Lists.newArrayList;
@JsonProperty("list-two")
private List<Object> list2 = Lists.newArrayList;
@JsonProperty("list-three")
private List<Object> list3 = Lists.newArrayList;
@JsonProperty("list-four")
private List<Object> list4 = Lists.newArrayList;
}
When jackson attempts to deserialize a response where only list-one & list-two are present, I expect the resulting POJO to have properties list3 and list4 as an empty list which is the default value, but instead they are deserialized as null.
What is missing to insure all properties will either contain the corresponding value from the deserialized JSON, or empty list which is the default assigned value?
---Update---- This was not an issue until I upgraded from Spring 1.3.5 to 1.4.2, which also upgraded my Jackson version from 2.6.6 to 2.8.4
Lists.newArrayList()is a method by the google guava library which does as it sounds. I have also tried removing theNoArgsConstructorby lombok & defining my own which initializes all fields to empty lists and it still does not work