I have an entity that contains collection as attribute:
public class Entity {
@JsonProperty(value=\"homes\")
@JsonDeserialize(as=HashSet.class, cont
What worked for me was simply to remove the setter and make the attribute final. jackson 2 will then use the getter to modify the list.
public class Entity {
@JsonProperty(value="homes")
@JsonDeserialize(as=HashSet.class, contentAs=HomeImpl.class)
private final Collection homes = new ArrayList();
public List getHomes() {
return homes;
}
}
The responsible feature is USE_GETTERS_AS_SETTERS which is turned on by default: https://github.com/FasterXML/jackson-databind/wiki/Mapper-Features