Mono switchIfEmpty() is always called
It’s because switchIfEmpty accepts Mono “by value”. Meaning that even before you subscribe to your mono, this alternative mono’s evaluation is already triggered. Imagine a method like this: Mono<String> asyncAlternative() { return Mono.fromFuture(CompletableFuture.supplyAsync(() -> { System.out.println(“Hi there”); return “Alternative”; })); } If you define your code like this: Mono<String> result = Mono.just(“Some payload”).switchIfEmpty(asyncAlternative()); It’ll always … Read more