我正在尝试用邮递员以json格式发布请求。
我的json是:
{
"bud_year":"123",
"tran_ndate":"2073-10-10",
"tran_edate":"17-JUL-14",
"bank_code":"12an",
"bank_accno":"123",
"amount":"12351",
"payment_name":"1122",
"voucher_no":"123",
"depositSlipNo":"123"
}
我的模特课
public class Params {
private String bud_year;
private String tran_ndate;
@JsonFormat(pattern = "yyyy-MM-dd")
private Time tran_edate;
private String bank_code;
private String bank_accno;
private Long amount;
private String payment_name;
private String voucher_no;
private int depositSlipNo;
/* getter setters */
}
控制器类
@RequestMapping(value = "/savePayment", method = RequestMethod.POST)
public void savePayment(@RequestBody PaymentParams paymentParams){
paymentServices.savePayment(paymentParams);
}
错误是:
Could not read JSON document: Can not construct instance of java.sql.Time,
problem: null
Can not construct instance of java.sql.Time, problem: null
17-JUL-14表示2017年7月14日。如何在我的模型类中使tran_edate
属性接受17-JUL-14作为时间值?