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

后端 未结 6 1091
时光说笑
时光说笑 2021-02-12 18:41

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 19:04

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

    That class gives you access to a BindingResult object.

提交回复
热议问题