Feign request java.time serialization error

Feign request java.time serialization error

[com.majortom.facade.service.common.PageSlice<com.majortom.facade.service.dto.MsgDTO>] and content type [application/json]; nested exception is org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Cannot deserialize value of type `java.time.LocalDateTime` from String "2022-10-25 17:27:11": Failed to deserialize java.time.LocalDateTime: (java.time.format.DateTimeParseException) Text '2022-10-25 17:27:11' could not be parsed at index 10; nested exception is com.fasterxml.jackson.databind.exc.InvalidFormatException: Cannot deserialize value of type `java.time.LocalDateTime` from String "2022-10-25 17:27:11": Failed to deserialize java.time.LocalDateTime: (java.time.format.DateTimeParseException) Text '2022-10-25 17:27:11' could not be parsed at index 10
Failed to deserialize java.time.LocalDateTime feign
原因是实体类或者返回对象包含的实践对象序列化失败,如果是实体对象,用俩个序列化注解注释,以下分别为包名和注解:com.fasterxml.jackson.databind.annotation;
com.fasterxml.jackson.annotation;
	@JsonDeserialize(using = LocalDateTimeDeserializer.class)
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")

Guess you like

Origin blog.csdn.net/weixin_45839894/article/details/128146810