这应该工作
@ControllerAdviceclass AdviceA { @ExceptionHandler({SomeException.class}) public ResponseEntity<String> handleSomeException(SomeException pe, HandlerMethod handlerMethod) { Class controllerClass = handlerMethod.getMethod().getDeclaringClass(); //controllerClass.toString will give you fully qualified name return new ResponseEntity<>("SomeString", HttpStatus.BAD_REQUEST); }


