[예외 처리 개선] GlobalExceptionHandler에서 검증 오류 상세 정보를 위한 내부 클래스 추가 및 불필요한 주석 제거. application.properties에 운영 환경 변수 설정 및 배치 처리 설정 추가.
This commit is contained in:
@@ -31,6 +31,9 @@ public class GlobalExceptionHandler {
|
|||||||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(response);
|
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 검증 오류 상세 정보를 위한 내부 클래스
|
||||||
|
private record ValidationError(String field, String message) {}
|
||||||
|
|
||||||
@ExceptionHandler(Exception.class)
|
@ExceptionHandler(Exception.class)
|
||||||
public ResponseEntity<ApiResponseDto<Void>> handleException(Exception e) {
|
public ResponseEntity<ApiResponseDto<Void>> handleException(Exception e) {
|
||||||
log.error("Unexpected error occurred", e);
|
log.error("Unexpected error occurred", e);
|
||||||
@@ -38,7 +41,4 @@ public class GlobalExceptionHandler {
|
|||||||
ApiResponseDto<Void> response = ApiResponseDto.fail(ApiResponseCode.COMMON_INTERNAL_SERVER_ERROR);
|
ApiResponseDto<Void> response = ApiResponseDto.fail(ApiResponseCode.COMMON_INTERNAL_SERVER_ERROR);
|
||||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(response);
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 검증 오류 상세 정보를 위한 내부 클래스
|
|
||||||
private record ValidationError(String field, String message) { }
|
|
||||||
}
|
}
|
||||||
|
@@ -19,10 +19,15 @@ spring.datasource.url=jdbc:postgresql://stam.kr:15432/imas
|
|||||||
spring.datasource.username=imas_user
|
spring.datasource.username=imas_user
|
||||||
spring.datasource.password=stam1201
|
spring.datasource.password=stam1201
|
||||||
spring.datasource.driver-class-name=org.postgresql.Driver
|
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 설정
|
# JPA/Hibernate 설정
|
||||||
# ========================================
|
# ========================================
|
||||||
|
# 개발 환경 설정
|
||||||
spring.jpa.hibernate.ddl-auto=none
|
spring.jpa.hibernate.ddl-auto=none
|
||||||
spring.jpa.open-in-view=false
|
spring.jpa.open-in-view=false
|
||||||
spring.jpa.show-sql=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.highlight_sql=true
|
||||||
spring.jpa.properties.hibernate.use_sql_comments=false
|
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.action=create
|
||||||
spring.jpa.properties.javax.persistence.schema-generation.scripts.create-target=ddl/schema.sql
|
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_access=900000
|
||||||
token.expiration_time_refresh=604800000
|
token.expiration_time_refresh=604800000
|
||||||
token.secret_key=c3RhbV9qd3Rfc2VjcmV0X3Rva2Vuc3RhbV9qd3Rfc2VjcmV0X3RhbV9qd3Rfc2VjcmV0X3RhbV9qd3Rfc2VjcmV0X3Rva2Vu
|
token.secret_key=c3RhbV9qd3Rfc2VjcmV0X3Rva2Vuc3RhbV9qd3Rfc2VjcmV0X3RhbV9qd3Rfc2VjcmV0X3RhbV9qd3Rfc2VjcmV0X3Rva2Vu
|
||||||
|
# 운영 환경 변수 설정 필요
|
||||||
|
# token.secret_key=${JWT_SECRET_KEY:}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# ========================================
|
# ========================================
|
||||||
# Swagger 설정
|
# Swagger 설정
|
||||||
|
Reference in New Issue
Block a user