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
βοΈ abstract classes and method
abstract class Animal {
// Abstract method (does not have a body)
public abstract void animalSound();
// Regular method
public void sleep() {
System.out.println("Zzz");
}
}
// Subclass (inherit from Animal)
class Pig extends Animal {
public void animalSound() {
// The body of animalSound() is provided here
System.out.println("The pig says: wee wee");
}
}
class Main {
public static void main(String[] args) {
Pig myPig = new Pig(); // Create a Pig object
myPig.animalSound();
myPig.sleep();
}
}
βοΈ Interface
// Interface
interface Animal {
public void animalSound(); // interface method (does not have a body)
public void sleep(); // interface method (does not have a body)
}
// Pig "implements" the Animal interface
class Pig implements Animal {
public void animalSound() {
// The body of animalSound() is provided here
System.out.println("The pig says: wee wee");
}
public void sleep() {
// The body of sleep() is provided here
System.out.println("Zzz");
}
}
class Main {
public static void main(String[] args) {
Pig myPig = new Pig(); // Create a Pig object
myPig.animalSound();
myPig.sleep();
}
}
ref
@SpringBootApplication
ref
@Valid
Test Code
ref
Long -> BoardId λ°Έλ₯ νμ
mapping ν λ λ²κ±°λ‘μμ κ²°κ΅ ν λ² μλνλ€κ°, Long Id λ‘ λ³κ²½νλ€.
Optional
@Builder.Dafult
μ²μμ @DynamicInsert λΆμ΄κ³ @Column(Default= 'μ΄μ©κ΅¬ ') ν΄μ μμ±νλ€.
ref
final, static, final static
ref
reflection
μ κ·Ό μ νμ μ€μ λ‘ μ¬μ©ν΄λ³΄κΈ°
enum
ref
ResponseEntity
Dependencies
mapstruct
generated ν
Logback + slf4j
lombok
Last updated