--Set exception handling with ExceptionHandler --Know which method of which controller caused the exception
--Add HandlerMethod handlerMethod
to the parameter of the method annotated with ExceptionHandler
MyExceptionHandler.java
@ExceptionHandler(MyException.class)
public ResponseEntity<String> myExceptionHandler(
MyException exception,
HandlerMethod handlerMethod) {
//abridgement
}
--See Javadoc for HandlerMethod
-- getMethod ()
and getMethodAnnotation (java.lang.Class <A> annotationType)
can be used
Principal
.end.
Recommended Posts