Warum, wenn ein Konstruktor mit @JsonCreator kommentiert wird, müssen seine Argumente mit @JsonProperty kommentiert werden?
In Jackson, wenn Sie einen Konstruktor mit annotieren@JsonCreator
, müssen Sie die Argumente mit annotieren@JsonProperty
. Also dieser Konstruktor
public Point(double x, double y) {
this.x = x;
this.y = y;
}
wird dies:
@JsonCreator
public Point(@JsonProperty("x") double x, @JsonProperty("y") double y) {
this.x = x;
this.y = y;
}
Ich verstehe nicht, warum es notwendig ist. Kannst du bitte Erklären?