How to configure Spring's RestTemplate to return null when HTTP status of 404 is returned
Foo foo = null;
try {
foo = restTemplate.getForObject(url, Foo.class, vars);
} catch (HttpClientErrorException ex) {
if (ex.getStatusCode() != HttpStatus.NOT_FOUND) {
throw ex;
}
}