Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] 스프링부트 시간대 설정을 KST 로 설정합니다. #213

Closed
1 task done
rlajm1203 opened this issue Jan 23, 2025 · 0 comments
Closed
1 task done
Labels
bug Something isn't working

Comments

@rlajm1203
Copy link
Collaborator

rlajm1203 commented Jan 23, 2025

Description

  • 현재 스프링 부트 서버의 시간대는 UTC 입니다. 이로 인해, 연속 접속 시간 및 누적 접속 시간 계산에서 오차가 발생하고 있습니다.

To Do

  • 스프링부트 시간대 KST 로 변경
    • 방법 1 : @PostConstruct 로 애플리케이션 초기화 중에 시간대를 설정한다.
    • 방법 2: ApplicationRunner 로 애플리케이션 컨텍스트 초기화 직후 시간대를 설정한다.
    • 방법 3 : java -jar 명령어로 실행할 때 옵션으로 JVM 시간대를 설정한다.

가장 좋은 방법은 3번인 것 같다.

1번 과 2번을 사용하게 될 경우, @PostConstruct 나 ApplicationRunner 는 특정 빈이 초기화 되거나, 애플리케이션 전체가 초기화 된 후에 시간대를 설정하는 건데, 만약 빈의 초기화 순서가 엇갈려서

시간대가 설정되기 이전에 특정 빈에서 시간을 참조한다면 예외 상황이 발생할 수 있으므로

안전한 3번 방법을 사용한다.

ETC

@rlajm1203 rlajm1203 added the bug Something isn't working label Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant