當映射到Java對象時,REST API採用輸入內容類型:application/x-www-form-urlencoded,如@JsonProperty不適用於Content-Type:application/x-www-form-urlencoded
public class MyRequest {
@JsonProperty("my_name")
private String myName;
@JsonProperty("my_phone")
private String myPhone;
//Getters and Setters of myName and myPhone.
}
在表單輸入請求中,我設置了my_name和my_phone的值,但MyRequest對象帶有myName和myPhone作爲null。
我使用傑克遜的註解2.3罐子
任何建議可能是什麼問題?