Skip to content

Instantly share code, notes, and snippets.

@dileeph
Created January 2, 2016 05:12
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save dileeph/c5f9eae2f971d91e1dda to your computer and use it in GitHub Desktop.
Save dileeph/c5f9eae2f971d91e1dda to your computer and use it in GitHub Desktop.
Getting List of Objects with RestTemplate in Spring
RestTemplate restTemplate = new RestTemplate();
try {
ResponseEntity<List<Claim>> claimResponse = restTemplate.exchange(
uri,
HttpMethod.GET,
null,
new ParameterizedTypeReference<List<Claim>>() {});
if(claimResponse != null && claimResponse.hasBody()){
claims = claimResponse.getBody();
}
} catch (RestClientException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment