JSR-303 @Valid validation throws BindException instead of MethodArgumentNotValidException [SPR-10157] #14790
Labels
in: web
Issues in web modules (web, webmvc, webflux, websocket)
status: declined
A suggestion or change that we don't feel we should currently apply
Mohammad Kurabi opened SPR-10157 and commented
When using
@Valid
without@RequestBody
on request parameter, the validation throws a BindException instead of a MethodArgumentNotValidException when the object fails validation.Noticed this issue when I realized my global exception handler that handles MethodArgumentNotValidException was not being invoked. I beleive this should be consistent and should throw MethodArgumentNotValidException when validation fails.
Example:
https://gist.github.com/c658b7f749df09b5465e
Affects: 3.2 GA
Reference URL: https://gist.github.com/c658b7f749df09b5465e
The text was updated successfully, but these errors were encountered: