How to find controller name in @controllerAdvice or @RestControllerAdvice in Spring MVC?
问题 @ControllerAdvice public class GlobalExceptionHandler { @ExceptionHandler(NoHandlerFoundException.class) public ResponseEntity<Error> handle(NoHandlerFoundException ex){ String message = "HTTP " + ex.getHttpMethod() + " for " + ex.getRequestURL() + " is not supported."; Error error = new Error(HttpStatus.NOT_FOUND.value(), message); return new ResponseEntity<Error>(error, HttpStatus.NOT_FOUND); } } I am using @ControllerAdvice with @ExceptionHandler. I need to get the exception occurred