에 이르게 :봄 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]
내 모든 모드 :
나는 다음과 같은 오류가 발생하고 ELS 그들에 @XmlRootElement
이 - 그리고 난
response.postForObject(...)
그래서이 작업을 수행하는 가장 쉬운 방법은 무엇입니까를 사용하여 직접 캐스팅 할 수 있습니까? postForEntity 방법에