Jackson 2.7.0を使用しています
encodingType既存のオブジェクトをいくつかの新しい値で更新するときに無視しようとしています:
ObjectMapper om = new ObjectMapper();
om.readerForUpdating(message).readValue(messageSubset);
messageの値が含まれていますencodingType。
messageSubset(JSON-string) には のエントリ (キー値なし) が含まれていませんencodingType。
私が試したこと:
- ObjectMapper の場合:
om.setSerializationInclusion(Include.NON_EMPTY);
- メッセージ クラス:
@JsonIgnoreProperties(ignoreUnknown = true)@JsonIgnoreProperties(value = { "encodingType" })@JsonInclude(Include.NON_EMPTY)@JsonInclude(Include.NON_NULL)
- フィールドとゲッター/セッターで:
@JsonInclude(Include.NON_EMPTY)@JsonInclude(Include.NON_NULL)@JsonIgnore@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
上記以外の作品!何か助けはありますか?
これは、readerForUpdating および/またはそのうちの 1 つが更新されているという事実と関係があると思います。