Skip to content

JSR-303 @Valid validation throws BindException instead of MethodArgumentNotValidException [SPR-10157] #14790

@spring-projects-issues

Description

@spring-projects-issues

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

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)status: declinedA suggestion or change that we don't feel we should currently apply

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions