From dbac9f4702f6eaa7e3a8ccd51c9d4252ca6634fc Mon Sep 17 00:00:00 2001 From: sohot8653 Date: Fri, 22 Aug 2025 09:09:21 +0900 Subject: [PATCH] =?UTF-8?q?[=EC=98=88=EC=99=B8=20=EC=B2=98=EB=A6=AC=20?= =?UTF-8?q?=EA=B0=9C=EC=84=A0]=20GlobalExceptionHandler=EC=97=90=EC=84=9C?= =?UTF-8?q?=20=EA=B2=80=EC=A6=9D=20=EC=98=A4=EB=A5=98=20=EC=83=81=EC=84=B8?= =?UTF-8?q?=20=EC=A0=95=EB=B3=B4=EB=A5=BC=20=EC=9C=84=ED=95=9C=20=EB=82=B4?= =?UTF-8?q?=EB=B6=80=20=ED=81=B4=EB=9E=98=EC=8A=A4=20=EC=B6=94=EA=B0=80=20?= =?UTF-8?q?=EB=B0=8F=20=EB=B6=88=ED=95=84=EC=9A=94=ED=95=9C=20=EC=A3=BC?= =?UTF-8?q?=EC=84=9D=20=EC=A0=9C=EA=B1=B0.=20application.properties?= =?UTF-8?q?=EC=97=90=20=EC=9A=B4=EC=98=81=20=ED=99=98=EA=B2=BD=20=EB=B3=80?= =?UTF-8?q?=EC=88=98=20=EC=84=A4=EC=A0=95=20=EB=B0=8F=20=EB=B0=B0=EC=B9=98?= =?UTF-8?q?=20=EC=B2=98=EB=A6=AC=20=EC=84=A4=EC=A0=95=20=EC=B6=94=EA=B0=80?= =?UTF-8?q?.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../global/exception/GlobalExceptionHandler.java | 6 +++--- src/main/resources/application.properties | 15 +++++++++++++++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/bio/bio_backend/global/exception/GlobalExceptionHandler.java b/src/main/java/com/bio/bio_backend/global/exception/GlobalExceptionHandler.java index e1ccf03..3b41735 100644 --- a/src/main/java/com/bio/bio_backend/global/exception/GlobalExceptionHandler.java +++ b/src/main/java/com/bio/bio_backend/global/exception/GlobalExceptionHandler.java @@ -31,6 +31,9 @@ public class GlobalExceptionHandler { return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(response); } + // 검증 오류 상세 정보를 위한 내부 클래스 + private record ValidationError(String field, String message) {} + @ExceptionHandler(Exception.class) public ResponseEntity> handleException(Exception e) { log.error("Unexpected error occurred", e); @@ -38,7 +41,4 @@ public class GlobalExceptionHandler { ApiResponseDto response = ApiResponseDto.fail(ApiResponseCode.COMMON_INTERNAL_SERVER_ERROR); return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(response); } - - // 검증 오류 상세 정보를 위한 내부 클래스 - private record ValidationError(String field, String message) { } } diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 1183039..ca3c378 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -19,10 +19,15 @@ spring.datasource.url=jdbc:postgresql://stam.kr:15432/imas spring.datasource.username=imas_user spring.datasource.password=stam1201 spring.datasource.driver-class-name=org.postgresql.Driver +# 운영 환경 변수 설정 필요 +# spring.datasource.url=${DB_URL:} +# spring.datasource.username=${DB_USERNAME:} +# spring.datasource.password=${DB_PASSWORD:} # ======================================== # JPA/Hibernate 설정 # ======================================== +# 개발 환경 설정 spring.jpa.hibernate.ddl-auto=none spring.jpa.open-in-view=false spring.jpa.show-sql=false @@ -30,6 +35,12 @@ spring.jpa.properties.hibernate.format_sql=true spring.jpa.properties.hibernate.highlight_sql=true spring.jpa.properties.hibernate.use_sql_comments=false +# 배치 처리 설정 +spring.jpa.properties.hibernate.default_batch_fetch_size=100 +spring.jpa.properties.hibernate.jdbc.batch_size=100 +spring.jpa.properties.hibernate.order_inserts=true +spring.jpa.properties.hibernate.order_updates=true + # 스키마 생성 설정 spring.jpa.properties.javax.persistence.schema-generation.scripts.action=create spring.jpa.properties.javax.persistence.schema-generation.scripts.create-target=ddl/schema.sql @@ -83,6 +94,10 @@ decorator.datasource.p6spy.log-format=%(sqlSingleLine) token.expiration_time_access=900000 token.expiration_time_refresh=604800000 token.secret_key=c3RhbV9qd3Rfc2VjcmV0X3Rva2Vuc3RhbV9qd3Rfc2VjcmV0X3RhbV9qd3Rfc2VjcmV0X3RhbV9qd3Rfc2VjcmV0X3Rva2Vu +# 운영 환경 변수 설정 필요 +# token.secret_key=${JWT_SECRET_KEY:} + + # ======================================== # Swagger 설정