Some people argue that this example: > That all...
# spring
i
Some people argue that this example:
That allows to provide convenient API for RestTemplate (thanks to Jon Schneider from Netflix for contributing this). For example, to retrieve a list of Foo objects in Java you have to write:
List<Foo> result = restTemplate.exchange(url, HttpMethod.GET, null, new ParameterizedTypeReference<List<Foo>>() { }).getBody();
While in Kotlin with Spring Framework 5 extensions you will be able to write:
val result : List<Foo> = restTemplate.getForObject(url)
can be wrote in more nice way in java:
Copy code
List<Foo> result = Arrays.asList(restTemplate.getForObject(url, Foo[].class))
👍 1