Previously my project had Hystrix for timeouts. Since after Spring Boot upgrade it turned out that Hystrix is no longer supported/developed I needed alternative. One alternative seems to be Resilience4j but I get io.github.resilience4j.timelimiter.configure.IllegalReturnTypeException
with it.
Example from Hystrix:
@HystrixCommand(commandProperties = {@HystrixProperty(name = TIMEOUT, value = "60000")})
public List<CustomBlahClass> getBlaBlaBla(...) {
If I now replace @HystrixCommand(...)
with @TimeLimiter(name = "myTimeLimiter")
I get error:
io.github.resilience4j.timelimiter.configure.IllegalReturnTypeException: package.CustomBlahClass package.MyService#getBlaBlaBla has unsupported by @TimeLimiter return type. CompletionStage expected.
When I searched this issue I found that methods need to be of type CompletableFuture<T>
.
Is refactoring all methods in all services to return CompletableFuture really the only option or am I missing something?