π GitHub λ°λ‘κ°κΈ°
π Debug Issue λ°λ‘κ°κΈ°
π¨ PropertyValueException : not-null property references a null or trasient value
nullable = false
λ‘ νμλ νλ β null κ°μ μ μ₯ν λ λ°μνλ Error
Dto
: μ μμ μΌλ‘ νλ λκ° μ μΈλμ΄ μμ β
Entity
: μ μμ μΌλ‘ μμ±μ Annotation μ μΈλμ΄ μμ β
Service
: μ μμ μΌλ‘ Repository κ°μ²΄ μμ± β
// Memo μμ±νκΈ°
@PostMapping("/api/memos")
public Memo createMemo(MemoRequestDto memoRequestDto) {
return memoService.createMemo(memoRequestDto);
}
Controller
μ createMemo
λ©μλ νλΌλ―Έν°μ @RequestBody
Annotation λλ½ π₯Bodyμ μ λ¬λλ λ°μ΄ν° β λ©μλ μΈμ(κ°μ²΄)μ 맀μΉνμ¬ λ°μ΄ν°λ₯Ό λ°μ μ²λ¦¬ν μ μλ Annotation
Clientκ° λ³΄λ΄λ HTTP Request λ³Έλ¬Έ(JSON) β Java Objectλ‘ λ³ν
Client μ
λ ₯κ° β HTTP Bodyμ Json ννλ‘ λμ΄κ°
β νλΌλ―Έν°μ @RequestBody + κ°μ λ°μμ¬ κ°μ²΄ μ§μ
μ μ΅ν μλ£ κ°μ¬ν©λλ€.