[英]RestClientException Could not extract response: no suitable HttpMessageConverter found for response type
I have following PoJo: 我有以下PoJo:
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class KostenpflichtigeBuchung {
private String buchungZahlungsId;
private String warenkorbId;
private String pseudocardpan;
private Zahlungsmittel zahlungsmittel;
private String landKreditkartenInhaber;
private String nameKreditkartenInhaber;
private String touchpointId;
private String vertriebspartnerId;
private Kundendaten kundendaten;
private Fulfillmentart fulfillmentart;
private final List<Reisender> reisenderList = new ArrayList<>();
@JsonIgnore
private Map<String, Object> payload;
@JsonAnyGetter
public Map<String, Object> getPayload() {
return payload;
}
@JsonAnySetter
public void setPayload(String name, Object value) {
if (payload == null) {
payload = new HashMap<>();
}
payload.put(name, value);
}
}
When I execute a cucumber Test on it, I get the following Exception: 当我对其执行黄瓜测试时,出现以下异常:
org.springframework.web.client.RestClientException: Could not extract response: no suitable HttpMessageConverter found for response type [class de.db.vendo.bue.buchung.model.KostenpflichtigeBuchung] and content type [application/json;charset=utf-8]
at org.springframework.web.client.HttpMessageConverterExtractor.extractData(HttpMessageConverterExtractor.java:109)
at org.springframework.web.client.RestTemplate$ResponseEntityResponseExtractor.extractData(RestTemplate.java:917)
at org.springframework.web.client.RestTemplate$ResponseEntityResponseExtractor.extractData(RestTemplate.java:901)
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:655)
at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:613)
at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:531)
I have some other test and other POJO with the same annotation which are working without any problems. 我有一些其他的测试和具有相同批注的其他POJO,它们可以正常工作。 I have really not a single idea what is going wrong.
我真的不知道哪里出了问题。
Thank for any suggestion! 感谢您的任何建议!
Most probably issue between lombok constructor annotations and related generated constructors, often when I face this error, I just revert response class to @NoArgConstructor only and try again. 最有可能在lombok构造函数批注和相关的生成的构造函数之间出现问题,通常当我遇到此错误时,我仅将响应类还原为@NoArgConstructor,然后重试。
If you really need all these constructors and builders, try to code them manually and go with @JsonCreator like describe in this thread . 如果确实需要所有这些构造函数和构建器,请尝试手动对其进行编码,并使用@JsonCreator,如该线程中的 describe。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.