这应该工作
@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); }
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)