【发布时间】:2020-08-04 17:44:46
【问题描述】:
输入json
[{"customerId":"1","customerName":"a"}, {"customerId":"2","customerName":"b"}]
【问题讨论】:
标签: spring-boot rest validation http-post
输入json
[{"customerId":"1","customerName":"a"}, {"customerId":"2","customerName":"b"}]
【问题讨论】:
标签: spring-boot rest validation http-post
您需要以适当的方式为参数定义请求--
.
postCustomers(Customers customers)
.
Customers 可以定义为 --public class Customers {
@JsonProperty("customers")
private List<Customer> customers;
}
.
Customer 可以基于所需的属性进行建模--public class Customer {
@JsonProperty("customerId")
private String customerId;
@JsonProperty("customerName")
private String customerName;
}
【讨论】: