File tree Expand file tree Collapse file tree 3 files changed +18
-17
lines changed
src/main/java/com/ururulab/ururu Expand file tree Collapse file tree 3 files changed +18
-17
lines changed Original file line number Diff line number Diff line change 11package com .ururulab .ururu ;
22
3- import com .ururulab .ururu .auth .jwt .JwtProperties ;
43import org .springframework .boot .SpringApplication ;
54import org .springframework .boot .autoconfigure .SpringBootApplication ;
6- import org .springframework .boot .context .properties .EnableConfigurationProperties ;
75import org .springframework .scheduling .annotation .EnableAsync ;
86
97@ EnableAsync
Original file line number Diff line number Diff line change 1+ package com .ururulab .ururu .global .config ;
2+
3+ import org .springframework .context .annotation .Configuration ;
4+ import org .springframework .data .jpa .repository .config .EnableJpaAuditing ;
5+
6+ @ Configuration
7+ @ EnableJpaAuditing
8+ public class JpaAuditingConfig {
9+ }
Original file line number Diff line number Diff line change 11package com .ururulab .ururu .global .domain .entity ;
22
33import jakarta .persistence .Column ;
4+ import jakarta .persistence .EntityListeners ;
45import jakarta .persistence .MappedSuperclass ;
5- import jakarta .persistence .PrePersist ;
6- import jakarta .persistence .PreUpdate ;
76import lombok .Getter ;
7+ import org .springframework .data .annotation .CreatedDate ;
8+ import org .springframework .data .annotation .LastModifiedDate ;
9+ import org .springframework .data .jpa .domain .support .AuditingEntityListener ;
810
911import java .time .ZonedDateTime ;
1012
1113@ Getter
1214@ MappedSuperclass
15+ @ EntityListeners (AuditingEntityListener .class )
1316public abstract class BaseEntity {
1417
18+ @ CreatedDate
1519 @ Column (nullable = false , updatable = false )
16- private ZonedDateTime createdAt ; // 생성 시간
20+ private ZonedDateTime createdAt ;
1721
22+ @ LastModifiedDate
1823 @ Column (nullable = false )
19- private ZonedDateTime updatedAt ; // 수정 시간
20-
21- @ PrePersist
22- public void prePersist () {
23- this .createdAt = ZonedDateTime .now ();
24- this .updatedAt = ZonedDateTime .now ();
25- }
26-
27- @ PreUpdate
28- public void preUpdate () {
29- this .updatedAt = ZonedDateTime .now ();
30- }
24+ private ZonedDateTime updatedAt ;
3125}
You can’t perform that action at this time.
0 commit comments