0
Ich habe folgende KlasseFrühling Stiefel RestTemplate Deserialisierung Ausgabe
public class RestResponseDto {
private Boolean status;
private Object data;
private Object error;
public RestResponseDto(Boolean status, Object data, Object error) {
this.status = status;
this.data = data;
this.error = error;
}
//Getters and setters
}
Ich versuche, meinen anderen REST API (GET-Request) und ordnen Sie die Antwort auf diese Klasse zu schlagen.
RestTemplate restTemplate = new RestTemplate();
RestResponseDto result = restTemplate.getForObject(uri, RestResponseDto.class);
Aber ich erhalte den folgenden Fehler:
Failed to read HTTP message: org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Can not construct instance of xxx.xxx.xxx.xxx: no suitable constructor found, can not deserialize from Object value (missing default constructor or creator, or perhaps need to add/enable type information?);
Haben Sie einen Standard-No-Args-Konstruktor? –