ResponseEntity<String> responseEntity = null;
try {
restTemplate.postForEntity("http://localhost:1111/test", null, String.class);
} catch (HttpStatusCodeException e) {
e.getStatusCode();
e.getResponseBodyAsString();
e.getResponseHeaders();
}
捕捉HttpStatusCodeException替代RestClientException