我已经搜索了一个答案,但无法找到答案。我在restTemplate.exchange()期间得到500内部服务器错误。我尝试逐个获取~1000个对象,并且应用程序抛出一个错误并停止在200~对象周围。
我需要弄清楚如何绕过这个特定的对象//响应并继续获取其余的对象。任何想法怎么做?
这是我的代码
@Override
public List<CapacityDto> getCapacity(String id) {
String url = apiCapacitiesUrl + id + STATS;
HttpHeaders headers = new HttpHeaders();
headers.set("Authorization", "Bearer " + apiCapacitiesToken);
HttpEntity<String> httpEntity = new HttpEntity<String>(headers);
log.info("getCapacity url: " + url);
ResponseEntity<CapacityDto[]> response = restTemplate.exchange(url, HttpMethod.GET, httpEntity, CapacityDto[].class);
CapacityDto[] capacities = response.getBody();
return Arrays.asList(capacities);
}