0

@ExceptionHandler 주석을 사용할 때 예외 개체에 들어가는 방법이 있습니까? 내가 perticular 필드에 대한 사용자 정보를 포함 할 반환 메시지를 가지고 싶습니다예외 처리기 메서드 내에서 오류 개체에 액세스

@ExceptionHandler(DataInputException.class) 
    public ResponseEntity handleException(){ 
     return ResponseEntity 
        .status(HttpStatus.BAD_REQUEST) 
        .body("Entity contains null or forbidden values"); 
    } 

:

내 코드입니다. (그 이유는 오류 개체가 필요합니다.) 예외의

답변

3

패스

@ExceptionHandler(DataInputException.class) 
public ResponseEntity handleException(DataInputException exception) {