We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
data class CheckOutDto( var checkOutId: Long?, val memberId: Long, val productId: Long, val amount : Long, val shippingAddress : String, var createdAt : LocalDate? )
다음과 같은 dataClass가 있다고 했을 때에 JsonString으로 들어온 data를
val checkOutDto = objectMapper.readValue<CheckOutDto>(jsonMessage)
위와 같이 사용하려고 하면 아래와 같은 에러가 발생하게 된다.
(no Creators, like default construct, exist): cannot deserialize from Object value (no delegate- or property-based Creator)
해결 법은 간단하다 다음과 같이 ObjectMapper에 registerModule을 달아 주면된다.
ObjectMapper().registerModule(KotlinModule())
하지만 이는 deprecated가 되었다고 ide에서 경고를 준다. 현재 2023년 3월 기준 최신 방법인 다음과 같이 달아주면 된다.
return ObjectMapper().registerKotlinModule()
필자(saechimdaeki) 는 보통 경우 ObjectMapper를 다음과 같이 Bean으로 등록해서 사용함.
@Bean fun customObjectMapper() : ObjectMapper { return ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false) .registerModule(JavaTimeModule()) .registerKotlinModule() }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
다음과 같은 dataClass가 있다고 했을 때에 JsonString으로 들어온 data를
위와 같이 사용하려고 하면 아래와 같은 에러가 발생하게 된다.
해결 법은 간단하다 다음과 같이 ObjectMapper에 registerModule을 달아 주면된다.
하지만 이는 deprecated가 되었다고 ide에서 경고를 준다. 현재 2023년 3월 기준 최신 방법인 다음과 같이 달아주면 된다.
필자(saechimdaeki) 는 보통 경우 ObjectMapper를 다음과 같이 Bean으로 등록해서 사용함.
The text was updated successfully, but these errors were encountered: