Ok, so the behavior of @JsonIgnore was radically changed from 1.9 onwards (for the worse imo). Without going into the devilish details of why your property is not being ignore during deserialization, try this code to fix it:
public class UserAccount implements HasMoney {
@JsonIgnore
private BigDecimal money;
// Other variable declarations, constructors
@Override
@JsonProperty
public BigDecimal getMoney() {
return money;
}
@JsonIgnore
@Override
public void setMoney(final BigDecimal money) {
this.money = money;
}
// Other getters/setters
}
Note the use of @JsonIgnore
on the field - its required for a working solution.
Note: depending on your environment and use case, you may need additional configuration on your ObjectMapper instance, for example, USE_GETTERS_AS_SETTERS, AUTO_DETECT_GETTERS, AUTO_DETECT_SETTERS etc.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…