curl -i -H 'content-type: application/json' -X POST -d '{"requestData":"123"}' http://192.168.2.34:8080/test
controller:
@RequestMapping(value = Urls.ENTER, method = RequestMethod.POST) @ResponseBody public Response weicheEnter(@Valid @RequestBody final RequestDao request) { .... } @JsonIgnoreProperties(ignoreUnknown = true) public class RequestDao implements Serializable { private static final long serialVersionUID = 1L; @NotEmpty private String requestData; public String getRequestData() { return requestData; } public void setRequestData(String requestData) { this.requestData = requestData; } }
原文地址:http://blog.51cto.com/1385903/2094160