error-response
-
Spring Boot : ProblemDetailsExceptionHandlerSpring Boot 2024. 4. 10. 18:55
ProblemDetail ProblemDetail은 Spring Framework 6.0에 추가된 REST API의 에러 응답 표준이다. RFC 7807에 정의되어 있다. 참고: https://docs.spring.io/spring-framework/docs/6.0.7/reference/html/web.html#mvc-ann-rest-exceptions 아래는 간단히 Spring Boot의 기본 에러 응답을 ProblemDetail로 설정하는 방법을 설명한다. ProblemDetailsExceptionHandler 에러 응답 예시 아래는 Spring Boot의 기본 에러 응답을 ProblemDetail로 설정했을 때의 에러 응답 body이다. { "type": "about:blank", "title": ..
-
Spring Boot : Default Error Response : 기본 에러 응답Spring Boot 2024. 4. 10. 18:33
개발 환경Java 21Spring Boot 3.2.4기본 에러 응답Spring Boot에서 아무 설정도 하지 않고 RestController 구성하여 예외 발생시키면 다음과 같은 형태의 response body를 응답한다.{ "timestamp": "2024-04-05T13:37:51.440+00:00", "status": 405, "error": "Method Not Allowed", "path": "/"}어디에서 기본 에러 응답 body를 만드나?어디에서 어떤 과정을 거쳐 이런 형태의 에러 응답을 하는지 궁금하여 간략하게 정리해보았다.아래에 그 과정에서 알게된 몇 가지 설정도 적어두었다.아래에서 1차 처리package org.springframework.web.servlet.mv..