Jackson

h블로그·2021년 8월 25일
0

spring 3.0 이후부터 Jackson API 를 제공한다.

@RequestBody 매핑시 Jackson 사용

POST method로@RequestBody의 객체를 매핑할 때 Jackson2HttpMessageConverter가 Http body json 메시지를 Dto 객체로 매핑해준다.
ObjectMapper.readValue() 를 사용하기 때문에 Dto 객체에 Setter가 없어도 된다.

Property 란 ?

자바스크립트의 객체는 key, value 로 이루어진 프로퍼티들의 집합이다.

ObjectMapper가 Property를 찾기 위해서

  • 기본 생성자 (@NoArgsConstructor)
  • Getter : 프로퍼티는 getter를 통해서 변수를 도출한다.

GSon

기본생성자,getter 없이 필드가 private 이여도 매핑된다.

profile
😎🙈🙈🙈🤓

0개의 댓글