Skip to content

Commit

Permalink
Merge pull request #56 from bandalgomsu/develop
Browse files Browse the repository at this point in the history
[fix] : 타임존 설정
  • Loading branch information
bandalgomsu authored Jun 1, 2024
2 parents 66191e4 + 78ecf50 commit 7f43a3b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.example.jolvre;

import jakarta.annotation.PostConstruct;
import java.util.TimeZone;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
Expand All @@ -11,4 +13,8 @@ public static void main(String[] args) {
SpringApplication.run(GraduateMinionsApplication.class, args);
}

@PostConstruct
public void setTimeZone() {
TimeZone.setDefault(TimeZone.getTimeZone("Asia/Seoul"));
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package com.example.jolvre.common.entity;

import jakarta.persistence.Convert;
import jakarta.persistence.EntityListeners;
import jakarta.persistence.MappedSuperclass;
import java.time.LocalDateTime;
import lombok.Getter;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.convert.threeten.Jsr310JpaConverters.LocalDateTimeConverter;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

@Getter
Expand All @@ -15,8 +17,10 @@ public abstract class BaseTimeEntity {
// 등록일, 수정일을 공용으로 맵핑하기 위한 엔티티

@CreatedDate
@Convert(converter = LocalDateTimeConverter.class)
private LocalDateTime createdDate; // 등록일

@LastModifiedDate
@Convert(converter = LocalDateTimeConverter.class)
private LocalDateTime lastModifiedDate; // 수정일
}

0 comments on commit 7f43a3b

Please sign in to comment.