fix: JSON 데이타 custom 반영

- empty or null 필드 제외 하는 옵션 default에서 제외
       -> 각각 사용할 DTO에서 @JsonInclude 사용하여 제어 하도록
     ApiResponseDTO
       -> 미 사용 필드 제외 적용
dev
gitea-관리자 1 year ago
parent dfaa8bff8e
commit 27b1cc226a

@ -30,6 +30,7 @@ import org.springframework.validation.ObjectError;
/**
* <pre>
* description : Api
* TODO :: json @JsonIgnore
* packageName : kr.xit.core.model
* fileName : ApiResponseDTO
* author : julim
@ -65,6 +66,7 @@ public class ApiResponseDTO<T> implements IApiResponse {
@Setter
private String message;
@JsonIgnore
@Schema(example = " ", description = "HttpStatus.OK", requiredMode = Schema.RequiredMode.AUTO)
private HttpStatus httpStatus;

@ -1,7 +1,6 @@
package kr.xit.core.spring.config.support;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.PropertyAccessor;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.MapperFeature;
@ -56,8 +55,8 @@ public class CustomJacksonConfig {
ObjectMapper om = new ObjectMapper()
.enable(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES)
.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
.setSerializationInclusion(Include.NON_NULL)
.setSerializationInclusion(Include.NON_EMPTY)
//.setSerializationInclusion(Include.NON_NULL)
//.setSerializationInclusion(Include.NON_EMPTY)
.setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY)
.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false)
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)

Loading…
Cancel
Save