Announcement Announcement Module
Collapse
No announcement yet.
Can I return a list of Objects from restTemplate.getForEntity Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    Hi, your MyObject in

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

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

    Comment

    Working...
    X