1 注解

1.1 @JsonAnyGetter

解允许将 Map 字段作为标准属性使用,提供灵活性。

public class ExtendableBean {
    public String name;
    private Map<String, String> properties;

    @JsonAnyGetter
    public Map<String, String> getProperties() {
        return properties;
    }
}
# @JsonAnyGetter添加到Map字段的get方法上
{
    "name":"My bean",
    "attr2":"val2",
    "attr1":"val1"
}

1.2 @JsonGetter

什么是JSON

自定义注解处理BigDecimal的序列化和反序列化