Why Spring MVC does not allow to expose Model or BindingResult to an @ExceptionHandler?

后端 未结 6 2397
天命终不由人
天命终不由人 2021-02-12 18:32

Situation

I\'m trying to group the code that logs the exceptions and render a nice view in a few methods. At the moment the logic is sometime in the @RequestHand

6条回答
  •  悲哀的现实
    2021-02-12 18:57

    Actually it does, just create an @ExceptionHandler method for MethodArgumentNotValidException.

    That class gives you access to a BindingResult object.

提交回复
热议问题