Skip to content

Commit

Permalink
feat: TimeZone 설정, BaseTimeEntity 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
unanchoi committed May 18, 2024
1 parent b40b3e0 commit 1dce1cc
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package site.sopkathon.product.common.config;

import jakarta.annotation.PostConstruct;
import org.springframework.context.annotation.Configuration;

import java.util.TimeZone;

@Configuration
public class TimeZoneConfig {
@PostConstruct
public void init() {
TimeZone.setDefault(TimeZone.getTimeZone("Asia/Seoul"));
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package site.sopkathon.product.common.entity;


import jakarta.persistence.EntityListeners;
import jakarta.persistence.MappedSuperclass;
import lombok.Getter;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import java.time.LocalDateTime;

@MappedSuperclass
@EntityListeners(AuditingEntityListener.class)
@Getter
public abstract class BaseTimeEntity {

@CreatedDate
public LocalDateTime createdAt;

@LastModifiedDate
public LocalDateTime updatedAt;
}

0 comments on commit 1dce1cc

Please sign in to comment.