Develop/Spring2025. 10. 24. 11:45💥 Spring 예외 처리 및 커스텀 전략

기본적인 예외에 대한 개념// 기본 형태 - 로컬 처리@RestControllerpublic class UserController { @ExceptionHandler(UserNotFoundException.class) public ResponseEntity handle(UserNotFoundException ex) { return ResponseEntity.notFound().build(); }}// 확장 형태 - 전역 처리@RestControllerAdvice // = @ControllerAdvice + @ResponseBodypublic class GlobalExceptionHandler { @ExceptionHandler(UserNotFoundExc..

image