をリードし、私は春RestTemplateを使用して応答オブジェクトを取得するために次の行を使用しています:春RestTemplateレスポンスオブジェクトにキャストする前に、応答ステータスをチェックすることがない、適切な変換エラーに
final ResponseEntity<Object> genericErrorResponse = restTemplate
.postForEntity("urlvalue.com", request,
Object.class);
私の目標は
if the response is 200: cast to Custom200ResponseModel
If response is 500: cast to CustomErrorModel
をチェックすることです
org.springframework.web.client.RestClientException: Could not extract response:
no suitable HttpMessageConverter found for response type [class java.lang.Object] and content type [text/xml]
すべての私のmod:
私は、次のエラーが発生しますELSは、それらに@XmlRootElement
を持っている - と私はこれを行う最も簡単な方法は何である
response.postForObject(...)
を使用して直接キャストできますか?