【发布时间】:2017-12-08 13:15:31
【问题描述】:
我有以下 JSON 属性:
"created_at":"2017-12-08T10:56:01.000Z"
我想将使用 Jackson 的 JSON 文档反序列化为以下属性:
@JsonProperty("created_at")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-ddTHH:mm:ss.SSSZ")
private java.util.Date createdAt;
但它失败并出现以下异常:
org.springframework.web.client.RestClientException: Could not extract response: no suitable HttpMessageConverter found for response type [class com.example.domain.Product] and content type [application/json;charset=utf-8]
at org.springframework.web.client.HttpMessageConverterExtractor.extractData(HttpMessageConverterExtractor.java:119)
at org.springframework.web.client.RestTemplate$ResponseEntityResponseExtractor.extractData(RestTemplate.java:986)
at org.springframework.web.client.RestTemplate$ResponseEntityResponseExtractor.extractData(RestTemplate.java:969)
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:717)
at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:671)
at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:587)
我做错了什么以及如何解决?
【问题讨论】:
标签: json jackson resttemplate