Spring @ExceptionHandler handling multiple kinds of exceptions

后端 未结 3 1248
暖寄归人
暖寄归人 2021-02-03 22:18

I can\'t figure out how to handle more than one kind of exception by @ExceptionHandler.

I need to programmatically deal with these exceptions, for this I\'d need a shar

3条回答
  •  不思量自难忘°
    2021-02-03 23:03

    The @ExceptionHandler value can be set to an array of Exception types. If an exception is thrown matches one of the types in the list, then the method annotated with the matching @ExceptionHandler will be invoked. If the annotation value is not set then the exception types listed as method arguments are used. See the documentation for details.

提交回复
热议问题