Код: Выделить всё
WebClient webClient = WebClient.builder()
.defaultStatusHandler(HttpStatusCode::isError, resp -> ...)
.build();
В WebClient вы можете просто использовать retryWhen():
Код: Выделить всё
public Mono getData(String stockId) {
return webClient.get()
.uri(PATH_BY_ID, stockId)
.retrieve()
.bodyToMono(String.class)
.retryWhen(Retry.backoff(3, Duration.ofSeconds(2)));
}
Подробнее здесь: https://stackoverflow.com/questions/746 ... ing-boot-3
Мобильная версия