a question to validation of put calls to a REST endpoint using spring boot and javax.validation (not the spring validation).
You have the following method in the resource:
@PutMapping(...)
public Response getResult(@RequestBody @Valid myBody, @PathVariable @MyIdValidation long id) {
}
When I call the method, myBody
gets validated and I get a MethodArgumentNotValidException
in my exception handler. But parameter id
gets not validated!
Only if myBody
is valid, id
gets validated as well.
The only solution I found is to not use @Valid
, and implement the validation of the body myself.
Are there better solutions?
TIA Kibu