I have this class:
public class Foo {
private int bar;
public int getBar() {
return this.bar;
}
@JsonProperty("baaaaar")
public setBar(int bar) {
this.bar = bar;
}
}
Now if I serialize this, I would get the following result: {"baaaaar": 0}
which seems odd to me as I only applied @JsonProperty to the Setter. I thought the Getter would keep its default behavior, that is to use the property name, and "baaaaar" would only be used for deserialisation.
Is there a solution to this, or do I have to explicitly add @JsonProperty("bar")
to the Getter as well?