如果控制器使用 APPLICATION_XML_VALUE,则控制器工作正常,但无法与 APPLICATION_JSON_VALUE 一起使用。XML 请求正确填充所有字段,并且每个字段的 Json 版本都将为空。不确定我的 json 请求是否有问题?@ApiOperation(value = "Update Thing")@ApiResponses(value = { @ApiResponse(code = 200, message = "OK", response = MembershipType.class), @ApiResponse(code = 503, message = " broke"),@ApiResponse(code = 400, message = "error"), @ApiResponse(code = 500, message = "Internal server error") })@RequestMapping(value = "/{id}/{id2}", method = RequestMethod.POST, consumes = { MediaType.APPLICATION_JSON_VALUE }, produces = { MediaType.APPLICATION_JSON_VALUE })public ResponseEntity<String> doThing(@PathVariable(value = "id") String id, @PathVariable(value = "id2") String id2, @RequestBody MyObject myObjectRequest) { return null;}工作 XML 请求<myObjectRequest> <number>five</number> <music>rock</music> <color>RED</color></myObjectRequest>失败的 Json{ "myObjectRequest": { "number": "five", "music": "rock", "color": "RED" }}
添加回答
举报
0/150
提交
取消