Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sriganesh/a5d21982788a542f7776a0e3b6e436e6 to your computer and use it in GitHub Desktop.
Save sriganesh/a5d21982788a542f7776a0e3b6e436e6 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