Friday, 20 September 2019

RestTemplate: Map the response to a pojo

public static <T> T getResponse(String url, Class<T> clazz) {
 if (url == null || url.isEmpty()) {
  throw new RuntimeException("url must not be null or empty");
 }

 return REST_TEMPLATE.getForObject(url, clazz);
}


You can get complete working application from this link.

Previous                                                    Next                                                    Home

No comments:

Post a Comment