Spring RestTemplate and generic types ParameterizedTypeReference collections like List

前端 未结 6 674
一生所求
一生所求 2020-12-05 09:44

An Abstract controller class requires List of objects from REST. While using Spring RestTemplate its not mapping it to required class instead it returns Linked HashMAp

6条回答
  •  抹茶落季
    2020-12-05 10:26

    The easiest solution for me is to define an object MyOperationResult containing the list you expect as field and use restTemplate.getForObject to get this result.

提交回复
热议问题