refactor: 채팅 전송 시 현재 시간 보다 늦은 시간으로 기록되는 문제 수정#221
Merged
Conversation
Comment on lines
+23
to
+26
| @PostConstruct | ||
| public void init() { | ||
| TimeZone.setDefault(TimeZone.getTimeZone("Asia/Seoul")); | ||
| } |
There was a problem hiding this comment.
@PostConstruct에서 TimeZone.setDefault(...)로 JVM 기본 타임존을 런타임에 변경하면, 이미 초기화된 컴포넌트(예: Jackson/ Hibernate/ 스케줄러)가 기존 기본 타임존을 기준으로 동작을 고정해버릴 수 있어 환경에 따라 여전히 시간 오프셋이 남거나, 반대로 다른 도메인 시간 로직이 한꺼번에 바뀌는 부작용이 생길 수 있습니다. 이 설정이 필요하다면 (1) main에서 SpringApplication.run 호출 전에 기본 타임존을 설정하거나 (2) -Duser.timezone/spring.jackson.time-zone/spring.jpa.properties.hibernate.jdbc.time_zone처럼 설정 기반으로 명시해 영향 범위를 통제하는 쪽이 더 안전합니다. 또한 타임존 값은 하드코딩 대신 설정 값으로 빼 두는 편이 운영/테스트 환경 분리에 유리합니다.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🔍 개요
🚀 주요 변경 내용
💬 참고 사항
✅ Checklist (완료 조건)