class MyService {
@Cacheable("myCache")
public CompletableFuture<Optional<String>> doSomethingExpensive(String id) {
return CompletableFuture.completedFuture(Optional.ofNullable(id).map(i -> "PREFIX-" + i));
}
}
In the above example, a ClassCastException is thrown when doSomethingExpensive is called a second time to retrieve the cached value but the cache actually returns CompletableFuture<String> instead of expected CompletableFuture<Optional<String>>.
Both CompletableFuture and Optional are currently supported separately, it would be nice to have support for their combination.
spring version: 7.0.8
In the above example, a ClassCastException is thrown when
doSomethingExpensiveis called a second time to retrieve the cached value but the cache actually returnsCompletableFuture<String>instead of expectedCompletableFuture<Optional<String>>.Both CompletableFuture and Optional are currently supported separately, it would be nice to have support for their combination.
spring version: 7.0.8