I have a controller as following:
@RequestMapping(path = "validate", method = POST, consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, produces = APPLICATION_JSON_UTF8_VALUE) public ResponseEntity<Object> validate(@Valid @ModelAttribute ValidationRequest request) { } ValidationRequest is a POJO with couple of fields.
With this setup, I expect this method to accept POST parameters passed only through body of request. However, if we make a POST request like http://localhost:8080/validate?param1=a¶m2=b without any body, it still accepts it. I have marked all of fields inside ValidationRequest as mandatory.
Any suggestions? Am I missing something here?
ValidationRequestas well