Не существует экземпляров переменных типа, поэтому ResponseEntity соответствует ResponseEntityJAVA
Программисты JAVA общаются здесь
Anonymous
Не существует экземпляров переменных типа, поэтому ResponseEntity соответствует ResponseEntity

Сообщение Anonymous »

У меня есть следующий код, который я хочу изменить, чтобы использовать resilience4j:

Код: Выделить всё

  @TimeLimiter(name = "updateIdConnector")
@CircuitBreaker(name = "updateIdConnector", fallbackMethod = "fallbackRequestException")
public ResponseEntity updateToken(HttpHeaders headers, String url) {
helper.updateInternalToken(headers, url);
return ResponseEntity.noContent().build();
}
Я пробовал это:

Код: Выделить всё

  @TimeLimiter(name = "updateIdConnector")
@CircuitBreaker(name = "updateIdConnector", fallbackMethod = "fallbackRequestException")
public CompletableFuture updateTokenSec(HttpHeaders headers, String url) {
return CompletableFuture.supplyAsync(() -> {
helper.updateInternalToken(headers, url);
return ResponseEntity.noContent().build();
}).thenApply(result -> {
return result;
});
}
Я получаю сообщение об ошибке:

Код: Выделить всё

Required type: CompletableFuture 
Provided: CompletableFuture 

no instance(s) of type variable(s) exist so that ResponseEntity conforms to ResponseEntity inference variable U has incompatible bounds: equality constraints: ResponseEntity lower bounds: ResponseEntity
Знаете, как это исправить? Мне нужно вернуть CompletableFuture

Подробнее здесь: https://stackoverflow.com/questions/790 ... t-conforms

Вернуться в «JAVA»


Яндекс.Метрика