Use MethodArgumentNotValidException for model attribute arguments #29251
Labels
in: web
Issues in web modules (web, webmvc, webflux, websocket)
type: enhancement
A general enhancement
Milestone
Given that
MethodArgumentNotValidException
extendsBindException
, after #23107, we can now use the former instead of the latter for an@ModelAttribute
arguments. It is a more specific exception, which helps to provide method parameter details, and it aligns with@RequestBody
and will simplify default exception handling a bit.In addition, with the support for RFC 7807 in #27052 (and related issues), web exceptions now encapsulate error response details, and expose message codes for external control of the detail description, see #28814. This makes it even more useful to raise the
MethodArgumentNotValidException
sub-class.The text was updated successfully, but these errors were encountered: