springboot RestTemplate 解析泛型数据

2023-09-01 19:32:11 浏览数 (3)

代码语言:javascript复制
ParameterizedTypeReference<List<ModelDto>> typeReference = new ParameterizedTypeReference<List<ModelDto>>() {};
ResponseEntity<List<ModelDto>> respEntity = this.restTemplate.exchange(
        URL_MODELS,
        HttpMethod.GET,
        null,
        typeReference
);

0 人点赞