From 6e80989d6beea2d83d51afa2e141bcf2fc517e28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EA=B1=B4=ED=9D=AC?= Date: Tue, 25 Mar 2025 18:21:33 +0900 Subject: [PATCH 1/8] =?UTF-8?q?feat:=20=EC=A0=84=EC=97=AD=20=EC=98=88?= =?UTF-8?q?=EC=99=B8=20=EC=B2=98=EB=A6=AC=20=ED=81=B4=EB=9E=98=EC=8A=A4(Gl?= =?UTF-8?q?obalExceptionHandler)=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/advice/GlobalExceptionHandler.java | 114 ++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 src/main/java/com/example/log4u/common/advice/GlobalExceptionHandler.java diff --git a/src/main/java/com/example/log4u/common/advice/GlobalExceptionHandler.java b/src/main/java/com/example/log4u/common/advice/GlobalExceptionHandler.java new file mode 100644 index 00000000..7f9e2153 --- /dev/null +++ b/src/main/java/com/example/log4u/common/advice/GlobalExceptionHandler.java @@ -0,0 +1,114 @@ +package com.example.log4u.common.advice; + +import java.util.List; +import java.util.stream.Collectors; + +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatusCode; +import org.springframework.http.ResponseEntity; +import org.springframework.lang.NonNull; +import org.springframework.validation.BindException; +import org.springframework.web.bind.MethodArgumentNotValidException; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.RestControllerAdvice; +import org.springframework.web.context.request.ServletWebRequest; +import org.springframework.web.context.request.WebRequest; +import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler; + +import com.example.log4u.common.exception.ApiErrorResponse; +import com.example.log4u.common.exception.CommonErrorCode; +import com.example.log4u.common.exception.base.ErrorCode; +import com.example.log4u.common.exception.base.ServiceException; + +import jakarta.servlet.http.HttpServletRequest; +import lombok.extern.slf4j.Slf4j; + +@RestControllerAdvice +@Slf4j +public class GlobalExceptionHandler extends ResponseEntityExceptionHandler { + + @Override + public ResponseEntity handleMethodArgumentNotValid( + MethodArgumentNotValidException e, + @NonNull HttpHeaders headers, + @NonNull HttpStatusCode status, + @NonNull WebRequest request) { + HttpServletRequest servletRequest = ((ServletWebRequest)request).getRequest(); + + String requestUrl = servletRequest.getRequestURI(); + String httpMethod = servletRequest.getMethod(); + List errors = e.getBindingResult() + .getFieldErrors() + .stream() + .map(fieldError -> fieldError.getField() + ": " + fieldError.getDefaultMessage()) + .collect(Collectors.toList()); + + log.warn("Validation failed for request to {} {}. Errors: {}", + httpMethod, requestUrl, errors); + CommonErrorCode errorCode = CommonErrorCode.INVALID_PARAMETER; + return handleExceptionInternal(e, errorCode); + } + + @ExceptionHandler(IllegalArgumentException.class) + public ResponseEntity handleIllegalArgument(IllegalArgumentException e) { + String location = getExceptionLocation(e); + + log.warn("Illegal argument encountered at {}: {}", location, e.getMessage()); + + CommonErrorCode errorCode = CommonErrorCode.INVALID_PARAMETER; + return handleExceptionInternal(errorCode); + } + + @ExceptionHandler(ServiceException.class) + public ResponseEntity handleGiveMeTiConException(ServiceException e) { + String location = getExceptionLocation(e); + log.warn("Error invoke in our app at {}: {} ErrorCode: {}", location, e.getMessage(), e.getErrorCode()); + ErrorCode errorCode = e.getErrorCode(); + return handleExceptionInternal(errorCode); + } + + @ExceptionHandler({Exception.class}) + public ResponseEntity handleAllException(Exception e) { + String location = getExceptionLocation(e); + log.warn("Unhandled exception occurred at {}: {}", location, e.getMessage()); + + CommonErrorCode errorCode = CommonErrorCode.INTERNAL_SERVER_ERROR; + return handleExceptionInternal(errorCode); + } + + private ResponseEntity handleExceptionInternal(ErrorCode errorCode) { + return ResponseEntity.status(errorCode.getHttpStatus()) + .body(makeErrorResponse(errorCode)); + } + + private ApiErrorResponse makeErrorResponse(ErrorCode errorCode) { + return ApiErrorResponse.builder() + .errorMessage(errorCode.getErrorMessage()) + .errorCode(errorCode.getHttpStatus().value()) + .build(); + } + + private ResponseEntity handleExceptionInternal(BindException e, ErrorCode errorCode) { + return ResponseEntity.status(errorCode.getHttpStatus()) + .body(makeErrorResponse(e, errorCode)); + } + + private ApiErrorResponse makeErrorResponse(BindException e, ErrorCode errorCode) { + List validationErrorList = e.getBindingResult() + .getFieldErrors() + .stream() + .map(ApiErrorResponse.ValidationError::of) + .collect(Collectors.toList()); + + return ApiErrorResponse.builder() + .errorMessage(errorCode.getErrorMessage()) + .errorCode(errorCode.getHttpStatus().value()) + .errors(validationErrorList) + .build(); + } + + private String getExceptionLocation(Exception e) { + StackTraceElement element = e.getStackTrace()[0]; + return element.getClassName() + "." + element.getMethodName() + ":" + element.getLineNumber(); + } +} From ec1a1cd8cb71bd3b60aaa0076398e917bf57cddf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EA=B1=B4=ED=9D=AC?= Date: Tue, 25 Mar 2025 18:22:27 +0900 Subject: [PATCH 2/8] =?UTF-8?q?feat:=20=EB=AA=A8=EB=93=A0=20=EB=8F=84?= =?UTF-8?q?=EB=A9=94=EC=9D=B8=EC=97=90=EC=84=9C=20=EC=82=AC=EC=9A=A9?= =?UTF-8?q?=ED=95=A0=20=EA=B3=B5=ED=86=B5=20=EC=98=88=EC=99=B8=20=EC=9D=B8?= =?UTF-8?q?=ED=84=B0=ED=8E=98=EC=9D=B4=EC=8A=A4=20=EB=B0=8F=20ServiceExcep?= =?UTF-8?q?tion=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../log4u/common/exception/base/ErrorCode.java | 9 +++++++++ .../common/exception/base/ServiceException.java | 15 +++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 src/main/java/com/example/log4u/common/exception/base/ErrorCode.java create mode 100644 src/main/java/com/example/log4u/common/exception/base/ServiceException.java diff --git a/src/main/java/com/example/log4u/common/exception/base/ErrorCode.java b/src/main/java/com/example/log4u/common/exception/base/ErrorCode.java new file mode 100644 index 00000000..d55237eb --- /dev/null +++ b/src/main/java/com/example/log4u/common/exception/base/ErrorCode.java @@ -0,0 +1,9 @@ +package com.example.log4u.common.exception.base; + +import org.springframework.http.HttpStatus; + +public interface ErrorCode { + String name(); + HttpStatus getHttpStatus(); + String getErrorMessage(); +} diff --git a/src/main/java/com/example/log4u/common/exception/base/ServiceException.java b/src/main/java/com/example/log4u/common/exception/base/ServiceException.java new file mode 100644 index 00000000..060f128d --- /dev/null +++ b/src/main/java/com/example/log4u/common/exception/base/ServiceException.java @@ -0,0 +1,15 @@ +package com.example.log4u.common.exception.base; + + +import lombok.Getter; + +@Getter +public class ServiceException extends RuntimeException { + + private final ErrorCode errorCode; + + public ServiceException(ErrorCode errorCode) { + super(errorCode.getErrorMessage()); + this.errorCode = errorCode; + } +} From 5dc474fef2d8e7702189d86e7de6a1e4889df715 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EA=B1=B4=ED=9D=AC?= Date: Tue, 25 Mar 2025 18:22:38 +0900 Subject: [PATCH 3/8] =?UTF-8?q?feat:=20=EA=B3=B5=ED=86=B5=20=EC=98=88?= =?UTF-8?q?=EC=99=B8=20=EC=9D=91=EB=8B=B5=20=ED=81=B4=EB=9E=98=EC=8A=A4(Ap?= =?UTF-8?q?iErrorResponse)=20=EB=B0=8F=20=EC=97=90=EB=9F=AC=20=EC=BD=94?= =?UTF-8?q?=EB=93=9C=20=EA=B8=B0=EB=B0=98=20=EA=B5=AC=EC=A1=B0=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/exception/ApiErrorResponse.java | 29 ++++++++++++++++ .../common/exception/CommonErrorCode.java | 33 +++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 src/main/java/com/example/log4u/common/exception/ApiErrorResponse.java create mode 100644 src/main/java/com/example/log4u/common/exception/CommonErrorCode.java diff --git a/src/main/java/com/example/log4u/common/exception/ApiErrorResponse.java b/src/main/java/com/example/log4u/common/exception/ApiErrorResponse.java new file mode 100644 index 00000000..63afc991 --- /dev/null +++ b/src/main/java/com/example/log4u/common/exception/ApiErrorResponse.java @@ -0,0 +1,29 @@ +package com.example.log4u.common.exception; + +import java.util.List; + +import org.springframework.validation.FieldError; + +import com.fasterxml.jackson.annotation.JsonInclude; + +import lombok.Builder; +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@Getter +@Builder +@RequiredArgsConstructor +public class ApiErrorResponse { + private final String errorMessage; + private final int errorCode; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + private final List errors; + + public record ValidationError(String field, String message) { + + public static ValidationError of(final FieldError fieldError) { + return new ValidationError(fieldError.getField(), fieldError.getDefaultMessage()); + } + } +} diff --git a/src/main/java/com/example/log4u/common/exception/CommonErrorCode.java b/src/main/java/com/example/log4u/common/exception/CommonErrorCode.java new file mode 100644 index 00000000..bbfa3b01 --- /dev/null +++ b/src/main/java/com/example/log4u/common/exception/CommonErrorCode.java @@ -0,0 +1,33 @@ +package com.example.log4u.common.exception; + +import org.springframework.http.HttpStatus; + +import com.example.log4u.common.exception.base.ErrorCode; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@Getter +@RequiredArgsConstructor +public enum CommonErrorCode implements ErrorCode { + + INVALID_PARAMETER(HttpStatus.BAD_REQUEST, "잘못된 요청입니다"), + UNAUTHENTICATED(HttpStatus.UNAUTHORIZED,"로그인이 필요한 기능입니다."), + FORBIDDEN(HttpStatus.FORBIDDEN, "접근 권한이 없습니다"), + RESOURCE_NOT_FOUND(HttpStatus.NOT_FOUND, "요청 정보를 찾을 수 없습니다"), + INTERNAL_SERVER_ERROR(HttpStatus.INTERNAL_SERVER_ERROR, "서버 내부 오류입니다. 관리자에게 문의하세요.") + ; + + private final HttpStatus httpStatus; + private final String message; + + @Override + public HttpStatus getHttpStatus() { + return this.httpStatus; + } + + @Override + public String getErrorMessage() { + return this.message; + } +} From 82b3e2cd5c204f58f2cab9b3bb9b4753cd8b551a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EA=B1=B4=ED=9D=AC?= Date: Tue, 25 Mar 2025 18:23:13 +0900 Subject: [PATCH 4/8] =?UTF-8?q?feat:=20=EC=99=B8=EB=B6=80=20API=20?= =?UTF-8?q?=ED=98=B8=EC=B6=9C=EC=97=90=20=EB=8C=80=ED=95=9C=20=EC=98=88?= =?UTF-8?q?=EC=99=B8=20=EC=B2=98=EB=A6=AC=20=ED=81=B4=EB=9E=98=EC=8A=A4=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../exception/ExternalApiRequestException.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 src/main/java/com/example/log4u/common/external/exception/ExternalApiRequestException.java diff --git a/src/main/java/com/example/log4u/common/external/exception/ExternalApiRequestException.java b/src/main/java/com/example/log4u/common/external/exception/ExternalApiRequestException.java new file mode 100644 index 00000000..54b0717d --- /dev/null +++ b/src/main/java/com/example/log4u/common/external/exception/ExternalApiRequestException.java @@ -0,0 +1,13 @@ +package com.example.log4u.common.external.exception; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@Getter +@RequiredArgsConstructor +public class ExternalApiRequestException extends RuntimeException{ + + private final String statusCode; + private final String message; + +} From ac433553c28c23896729cef39dfcd31c5093deca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EA=B1=B4=ED=9D=AC?= Date: Tue, 25 Mar 2025 18:23:39 +0900 Subject: [PATCH 5/8] =?UTF-8?q?feat:=20RestTemplate=EC=9A=A9=20ResponseErr?= =?UTF-8?q?orHandler=20=EB=B0=8F=20=EC=84=A4=EC=A0=95=20=ED=81=B4=EB=9E=98?= =?UTF-8?q?=EC=8A=A4=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../log4u/common/external/ClientConfig.java | 18 ++++++++++ .../hanlder/ApiResponseErrorHandler.java | 34 +++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 src/main/java/com/example/log4u/common/external/ClientConfig.java create mode 100644 src/main/java/com/example/log4u/common/external/hanlder/ApiResponseErrorHandler.java diff --git a/src/main/java/com/example/log4u/common/external/ClientConfig.java b/src/main/java/com/example/log4u/common/external/ClientConfig.java new file mode 100644 index 00000000..e78d537b --- /dev/null +++ b/src/main/java/com/example/log4u/common/external/ClientConfig.java @@ -0,0 +1,18 @@ +package com.example.log4u.common.external; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.client.RestTemplate; + +import com.example.log4u.common.external.hanlder.ApiResponseErrorHandler; + +@Configuration +public class ClientConfig { + + @Bean + public RestTemplate restTemplate() { + RestTemplate restTemplate = new RestTemplate(); + restTemplate.setErrorHandler(new ApiResponseErrorHandler()); + return restTemplate; + } +} diff --git a/src/main/java/com/example/log4u/common/external/hanlder/ApiResponseErrorHandler.java b/src/main/java/com/example/log4u/common/external/hanlder/ApiResponseErrorHandler.java new file mode 100644 index 00000000..4bd2acdd --- /dev/null +++ b/src/main/java/com/example/log4u/common/external/hanlder/ApiResponseErrorHandler.java @@ -0,0 +1,34 @@ +package com.example.log4u.common.external.hanlder; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.stream.Collectors; + +import org.springframework.http.client.ClientHttpResponse; +import org.springframework.web.client.ResponseErrorHandler; + +import com.example.log4u.common.external.exception.ExternalApiRequestException; + +import lombok.extern.slf4j.Slf4j; + +@Slf4j +public class ApiResponseErrorHandler implements ResponseErrorHandler { + @Override + public boolean hasError(ClientHttpResponse response) throws IOException { + return !response.getStatusCode().is2xxSuccessful(); + } + + @Override + public void handleError(ClientHttpResponse response) throws IOException { + String body; + try (BufferedReader reader = new BufferedReader(new InputStreamReader(response.getBody()))) { + body = reader.lines().collect(Collectors.joining("\n")); + } + + log.error("API 호출 중 에러 발생: HTTP 상태 코드: {}, 응답 본문: {}", response.getStatusCode().value(), body); + + throw new ExternalApiRequestException(response.getStatusCode().toString(), + "API 호출 중 에러 발생: " + response.getStatusCode().value() + " 응답 본문: " + body); + } +} From 5c50c2d67dc3a2862a819357d0dbaf853e6af132 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EA=B1=B4=ED=9D=AC?= Date: Tue, 25 Mar 2025 18:24:36 +0900 Subject: [PATCH 6/8] =?UTF-8?q?feat:=20=EB=8F=84=EB=A9=94=EC=9D=B8=20?= =?UTF-8?q?=EC=98=88=EC=99=B8=20=EC=82=AC=EC=9A=A9=20=EC=98=88=EC=8B=9C?= =?UTF-8?q?=EB=A1=9C=20Comment=20=EB=8F=84=EB=A9=94=EC=9D=B8=20Exception?= =?UTF-8?q?=20=EA=B5=AC=EC=A1=B0=20=EC=98=88=EC=8B=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../comment/exception/CommentErrorCode.java | 28 +++++++++++++ .../comment/exception/CommentException.java | 10 +++++ .../exception/NotFoundCommentException.java | 7 ++++ .../testController/TestController.java | 40 +++++++++++++++++++ .../domain/comment/testDto/TestRequest.java | 19 +++++++++ 5 files changed, 104 insertions(+) create mode 100644 src/main/java/com/example/log4u/domain/comment/exception/CommentErrorCode.java create mode 100644 src/main/java/com/example/log4u/domain/comment/exception/CommentException.java create mode 100644 src/main/java/com/example/log4u/domain/comment/exception/NotFoundCommentException.java create mode 100644 src/main/java/com/example/log4u/domain/comment/testController/TestController.java create mode 100644 src/main/java/com/example/log4u/domain/comment/testDto/TestRequest.java diff --git a/src/main/java/com/example/log4u/domain/comment/exception/CommentErrorCode.java b/src/main/java/com/example/log4u/domain/comment/exception/CommentErrorCode.java new file mode 100644 index 00000000..9b6bf8ed --- /dev/null +++ b/src/main/java/com/example/log4u/domain/comment/exception/CommentErrorCode.java @@ -0,0 +1,28 @@ +package com.example.log4u.domain.comment.exception; + +import org.springframework.http.HttpStatus; + +import com.example.log4u.common.exception.base.ErrorCode; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@Getter +@RequiredArgsConstructor +public enum CommentErrorCode implements ErrorCode { + + NOT_FOUND_COMMENT(HttpStatus.NOT_FOUND, "댓글을 찾을 수 없습니다."); + + private final HttpStatus httpStatus; + private final String message; + + @Override + public HttpStatus getHttpStatus() { + return httpStatus; + } + + @Override + public String getErrorMessage() { + return message; + } +} diff --git a/src/main/java/com/example/log4u/domain/comment/exception/CommentException.java b/src/main/java/com/example/log4u/domain/comment/exception/CommentException.java new file mode 100644 index 00000000..17b0ee87 --- /dev/null +++ b/src/main/java/com/example/log4u/domain/comment/exception/CommentException.java @@ -0,0 +1,10 @@ +package com.example.log4u.domain.comment.exception; + +import com.example.log4u.common.exception.base.ErrorCode; +import com.example.log4u.common.exception.base.ServiceException; + +public class CommentException extends ServiceException { + public CommentException(ErrorCode errorCode) { + super(errorCode); + } +} diff --git a/src/main/java/com/example/log4u/domain/comment/exception/NotFoundCommentException.java b/src/main/java/com/example/log4u/domain/comment/exception/NotFoundCommentException.java new file mode 100644 index 00000000..af319025 --- /dev/null +++ b/src/main/java/com/example/log4u/domain/comment/exception/NotFoundCommentException.java @@ -0,0 +1,7 @@ +package com.example.log4u.domain.comment.exception; + +public class NotFoundCommentException extends CommentException { + public NotFoundCommentException() { + super(CommentErrorCode.NOT_FOUND_COMMENT); + } +} diff --git a/src/main/java/com/example/log4u/domain/comment/testController/TestController.java b/src/main/java/com/example/log4u/domain/comment/testController/TestController.java new file mode 100644 index 00000000..932ff616 --- /dev/null +++ b/src/main/java/com/example/log4u/domain/comment/testController/TestController.java @@ -0,0 +1,40 @@ +package com.example.log4u.domain.comment.testController; + +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import com.example.log4u.domain.comment.testDto.TestRequest; +import com.example.log4u.domain.comment.exception.NotFoundCommentException; + +import jakarta.validation.Valid; + +@RestController +@RequestMapping("/test") +public class TestController { + + @PostMapping("/valid") + public ResponseEntity testValidation(@RequestBody @Valid TestRequest request) { + return ResponseEntity.ok().build(); + } + + @GetMapping("/illegal") + public String testIllegalArgument() { + throw new IllegalArgumentException("잘못된 인자입니다!"); + } + + @GetMapping("/log4u") + public String testLog4uException() { + throw new NotFoundCommentException(); // 또는 임의의 ServiceException + } + + @GetMapping("/unknown") + public String testUnexpectedException() { + String str = null; + str.length(); // NPE + return "절대 도달하지 않음"; + } +} diff --git a/src/main/java/com/example/log4u/domain/comment/testDto/TestRequest.java b/src/main/java/com/example/log4u/domain/comment/testDto/TestRequest.java new file mode 100644 index 00000000..90c051ef --- /dev/null +++ b/src/main/java/com/example/log4u/domain/comment/testDto/TestRequest.java @@ -0,0 +1,19 @@ +package com.example.log4u.domain.comment.testDto; + +// dto/TestRequest.java +import jakarta.validation.constraints.Min; +import jakarta.validation.constraints.NotBlank; +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor +public class TestRequest { + + @NotBlank + private String name; + + @Min(value = 18, message = "나이는 18세 이상이어야 합니다.") + private int age; + +} From d03d62496e3725eb74da97a1044708d32bf8837c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EA=B1=B4=ED=9D=AC?= Date: Tue, 25 Mar 2025 18:25:23 +0900 Subject: [PATCH 7/8] =?UTF-8?q?feat:=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20?= =?UTF-8?q?=EC=8B=9C=20401=20=EC=83=81=ED=83=9C=20=EC=BD=94=EB=93=9C?= =?UTF-8?q?=EB=A1=9C=20=EC=9D=B8=ED=95=9C=20=EC=8A=A4=ED=94=84=EB=A7=81=20?= =?UTF-8?q?=EC=8B=9C=ED=81=90=EB=A6=AC=ED=8B=B0=20=EC=84=A4=EC=A0=95=20?= =?UTF-8?q?=EC=9E=84=EC=8B=9C=20=EC=A3=BC=EC=84=9D=20=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle.kts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 0ad7d420..74125b17 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -28,8 +28,8 @@ repositories { dependencies { implementation("org.springframework.boot:spring-boot-starter-data-jpa") - implementation("org.springframework.boot:spring-boot-starter-oauth2-client") - implementation("org.springframework.boot:spring-boot-starter-security") +// implementation("org.springframework.boot:spring-boot-starter-oauth2-client") +// implementation("org.springframework.boot:spring-boot-starter-security") implementation("org.springframework.boot:spring-boot-starter-validation") implementation("org.springframework.boot:spring-boot-starter-web") implementation("org.springframework.boot:spring-boot-starter-data-redis") From ecf432bfa2a7d9770a888d0f672adb7b94098ebb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EA=B1=B4=ED=9D=AC?= Date: Thu, 27 Mar 2025 00:58:09 +0900 Subject: [PATCH 8/8] =?UTF-8?q?remove:=20Test=20API=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/comment/testController/TestController.java | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/main/java/com/example/log4u/domain/comment/testController/TestController.java b/src/main/java/com/example/log4u/domain/comment/testController/TestController.java index 932ff616..268a29cd 100644 --- a/src/main/java/com/example/log4u/domain/comment/testController/TestController.java +++ b/src/main/java/com/example/log4u/domain/comment/testController/TestController.java @@ -30,11 +30,5 @@ public String testIllegalArgument() { public String testLog4uException() { throw new NotFoundCommentException(); // 또는 임의의 ServiceException } - - @GetMapping("/unknown") - public String testUnexpectedException() { - String str = null; - str.length(); // NPE - return "절대 도달하지 않음"; - } + }