Json) LocalDateTime Json으로 직렬화(ObjectMapper)

YIHN·2024년 3월 18일

SpringBoot

목록 보기
5/10

LocalDateTime을 Json으로 직렬화 할 때 발생하는 에러

com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Java 8 date/time type java.time.LocalDateTime not supported by default: add Module "com.fasterxml.jackson.datatype:jackson-datatype-jsr310" to enable handling (through reference chain: com.lineus.chappyback.feature.assignment_submission.api.dto.AssignmentGradeStatusResponse["endDate"])


해결방법

Jackson ObjectMapper 인스턴스에 JavaTimeModule 등록

적용 결과

DTO 데이터 타입

profile
오늘도 YIHN

0개의 댓글