Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
由于数据模型发生了变化,我重构了一个 rest 微服务。但是我们希望保留 json 有效负载(基于旧数据模型的服务),因为该有效负载正被多个其他服务使用。
请建议我用 POJO 字段映射 json 对象的好方法?
public class Data { String new; @JsonProperty("new") public String getNew() { return new; } @JsonProperty("old") public void setNew(String old) { this.new = old; } }
你试过使用@JsonProperty 吗?如果您使用的是杰克逊。