Phase 3

-ing

Test Code

Exception

ν•΄λ³΄κ³ μ‹Άμ—ˆλ˜ 도메인 둜직

@EntityListener(AuditingEntityListener.class)

  • BaseEntity(abstract class)λ₯Ό μƒμ„±ν•˜κ³ , 이 extendsν•˜μ—¬ createdAt, updatedAt ν•„λ“œμ™€ 같은 κ³΅ν†΅μœΌλ‘œ λ“€μ–΄κ°€λŠ” ν•„λ“œλ₯Ό 생성해쀀닀.

  • Sping main λ©”μ„œλ“œκ°€ λ“€μ–΄μžˆλŠ” νŒŒμΌμ— @EnableJpaAuditing μ–΄λ…Έν…Œμ΄μ…˜μ„ λΆ™μ—¬μ•Ό extends κ°€ 잘 μž‘λ™ν•˜μ—¬ μ§„μž…ν΄λž˜μŠ€μ— μœ„μ˜ μ–΄λ…Έν…Œμ΄μ…˜μ„ λΆ™μ—¬μ£Όμ—ˆλ‹€.

  • @EntityListener(AuditingEntityListener.class)λ₯Ό BaseEntity μͺ½μ— λΆ™μ—¬μ£Όλ©΄ @EnableJpaAuditing μ–΄λ…Έν…Œμ΄μ…˜μ„ λΆ™μ—¬μ£Όμ§€ μ•Šμ•„λ„ 잘 μž‘λ™ν•œλ‹€.

μžλ°” 직렬화 Serializable

ref

Java Abstraction _ abstract classes and method

Data abstraction is the process of hiding certain details and showing only essential information to the user. Abstraction can be achieved with either abstract classes or interfaces .

βœ”οΈ abstract classes and method

βœ”οΈ Interface

An interface is a completely "abstract class" that is used to group related methods with empty bodies. To access the interface methods, the interface must be "implemented" (kinda like inherited) by another class with the implements keyword (instead of extends). The body of the interface method is provided by the "implement" class .

ref

@SpringBootApplication

ref

@Valid

Test Code

ref

Long -> BoardId λ°Έλ₯˜ νƒ€μž…

  • mapping ν•  λ•Œ λ²ˆκ±°λ‘œμ›Œμ„œ κ²°κ΅­ ν•œ 번 μ‹œλ„ν–ˆλ‹€κ°€, Long Id 둜 λ³€κ²½ν–ˆλ‹€.

Optional

@Builder.Dafult

  • μ²˜μŒμ— @DynamicInsert 뢙이고 @Column(Default= 'μ–΄μ©Œκ΅¬ ') ν•΄μ„œ μž‘μ„±ν–ˆλ‹€.

@DynamicInsert λž€...?

ref

final, static, final static

ref

reflection

μ ‘κ·Ό μ œν•œμž μ‹€μ œλ‘œ μ‚¬μš©ν•΄λ³΄κΈ°

enum

ref

ResponseEntity

Dependencies

mapstruct

generated 파

Logback + slf4j

lombok

e

@Getter - 이 μ• λ„ˆν…Œμ΄μ…˜μ΄ μ§€μ •λœ ν•„λ“œμ— λŒ€ν•΄ getter λ©”μ„œλ“œλ₯Ό μžλ™ μƒμ„±ν•œλ‹€. λ§Œμ•½ ν΄λž˜μŠ€μ— 이 μ• λ„ˆν…Œμ΄μ…˜μ„ μ‚¬μš©ν•˜λ©΄ ν•΄λ‹Ή 클래슀의 λͺ¨λ“  private ν•„λ“œμ— λŒ€ν•΄ getter λ©”μ„œλ“œλ₯Ό μƒμ„±ν•œλ‹€.

@RequiredArgsConstructure - 이 μ• λ„ˆν…Œμ΄μ…˜μ΄ μ§€μ •λœ 클래슀의 λͺ¨λ“  private final ν•„λ“œλ₯Ό μ΄ˆκΈ°ν™”ν•˜λŠ” νŒŒλΌλ―Έν„°λ“€μ΄ ν¬ν•¨λœ μƒμ„±μžλ₯Ό μžλ™ μƒμ„±ν•œλ‹€.

@NoArgsConstructor - μΈμžκ°€ μ—†λŠ” (λ””ν΄νŠΈ) μƒμ„±μžλ₯Ό μžλ™ μƒμ„±ν•œλ‹€.

Last updated