SPRING/Spring기본

null값 빼고 response

도전하는일반인 2021. 11. 11. 16:25
@JsonNaming(value= PropertyNamingStrategy.SnakeCaseStrategy.class)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class User {

DTO 클래스에 class 상단에 @JsonInclude(JsonInclude.Include.NON_NULL) 어노테이션을 넣어주면

 

response할 때 null인 값들은 자동으로 걸러서 보내준다.

'SPRING > Spring기본' 카테고리의 다른 글

IMG 파일 업로드하기(로컬 폴더에 저장하기)  (0) 2022.02.16
스프링 기본 설정  (0) 2022.02.14
AOP  (0) 2022.01.12
GET POST PUT api  (0) 2021.11.11
PathVariable 지정해주기  (0) 2021.11.11