Jersey/Jackson @JsonIgnore on setter

后端 未结 5 1107
暗喜
暗喜 2021-02-13 18:28

i have an class with the following annotations:

class A {
public Map> references;

@JsonProperty
public Map

        
5条回答
  •  不知归路
    2021-02-13 19:20

    As of Jackson 2.6, there is a new and improved way to define read-only and write-only properties, using JsonProperty#access() annotation. This is recommended over use of separate JsonIgnore and JsonProperty annotations.

    @JsonProperty(access = JsonProperty.Access.READ_ONLY)
    public Map> references;
    

提交回复
热议问题