Spring @ExceptionHandler handling multiple kinds of exceptions
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.
The @ExceptionHandler
value can be set to an array of Exception types.
The implementation of using exception array as mentioned in Spring documentation will be like:
@ExceptionHandler({
NotFoundException.class,
MissingServletRequestParameterException.class
})