Results 1 to 2 of 2

Thread: Can I return a list of Objects from restTemplate.getForEntity

Hybrid View

  1. #1
    Join Date
    Feb 2012
    Posts
    1

    Default Can I return a list of Objects from restTemplate.getForEntity

    I know I Can do this:

    ResponseEntity<MyObject> myObject = restTemplate.getForEntity(url, MyObject.class );

    but can I easily return a List of Objects as well, like this:


    ResponseEntity<List<MyObject>> myObjectList = restTemplate.getForEntity(url, ???.class );

    I'm new to this, so I may be missing something easy here...

    I read that there are messageConverters, but I was hoping I wouldn't have to right one...or maybe they aren't that bad to right. Any examples would be great.

  2. #2
    Join Date
    May 2011
    Location
    Madrid (Spain)
    Posts
    101

    Default

    Hi, your MyObject in

    ResponseEntity<MyObject> myObject = restTemplate.getForEntity(url, MyObject.class );

    can have a getList() method, is it good for you?

Tags for this Thread

Posting Permissions

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