Skip to content

Reading typed lists with RestTemplate [SPR-8263] #12911

Closed
@spring-projects-issues

Description

@spring-projects-issues

Craig Walls opened SPR-8263 and commented

With RestTemplate's methods, it is possible to request an object of a specific type...e.g.:

Foo foo = restTemplate.getForObject("some uri", Foo.class);

But if I want to retrieve a list of Foos, this won't work:

List<Foo> foos = restTemplate.getForObject("some uri", List.class);

Because there's no way to specify the type of the List to return, I get back a List of Map instead. It'd be nice if there was a way to specify the List's generic type so that I can get back a List<Foo> and not have to extract Foo objects from Map objects.


1 votes, 4 watchers

Metadata

Metadata

Assignees

Labels

status: declinedA suggestion or change that we don't feel we should currently applytype: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions