Results 1 to 2 of 2

Thread: How to get a List<MyObject> via RestTemplate

  1. #1
    Join Date
    Jul 2012
    Posts
    2

    Default How to get a List<MyObject> via RestTemplate

    So if you just have one object you can do:
    Code:
    Mine m = restTemplate(getForObject(url, Mine.class);
    What about if the object coming across the wire is a List<Mine.class> how would you write that?

  2. #2
    Join Date
    Nov 2010
    Posts
    175

    Default

    Hi, we are working on merging in changes from Spring 3.2, which will include generics support in RestTemplate requests. For now, this can be accomplished using arrays.

    Code:
    ResponseEntity<Mine[]> responseEntity = restTemplate.getForEntity(url, Mine[].class);
    Roy Clarkson
    Spring Mobile Projects Lead

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •