当尝试反序列化包含LocalDateTime字段的JSON POST响应时,我遇到了异常。
feign.codec.DecodeException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING
以下是JSON格式的响应:
{
"date":"2018-03-18 01:00:00.000"
}
这是我创建远程服务的方法:
@PostConstruct
void createService() {
remoteService = Feign.builder()
.decoder(new GsonDecoder())
.encoder(new GsonEncoder())
.target(RemoteInterface.class, remoteUrl);
}
我该如何强制Feign将日期反序列化为LocalDateFormat?