我有一个这样的Spring Boot RestController
public class MyRestController{ @RequestMapping(value = "/resources", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) @ApiResponses(value = { @ApiResponse(code = 201, message = "Created", response = Resource.class) }) @ResponseStatus( HttpStatus.CREATED ) public Resource createResource(@RequestBody Resource res){ } @JsonIgnoreProperties(ignoreUnknown = false) public class Resource{ private String resourceName; private int value; }
当我像这样传递json时:
{ "unknownProperty": "test", "value::100 }
我希望抛出一个异常,因为我设置了@JsonIgnoreProperties(ignoreUnknown=false),但这并没有发生。缺少什么?