Spring MVC – RestTemplate launch exception when http 404 happens
As far as I’m aware, you can’t get an actual ResponseEntity, but the status code and body (if any) can be obtained from the exception: try { ResponseEntity<StoreDto> r = restTemplate.getForEntity(url, StoreDto.class, m); } catch (final HttpClientErrorException e) { System.out.println(e.getStatusCode()); System.out.println(e.getResponseBodyAsString()); }