Reactor provides possibility to shift execution context to a different Scheduler like following:
Mono.just("test")
.doOnNext(x -> System.out.println(currentThread().getName() + " " + x))
.publishOn(MY_SCHEDULER)
.doOnNext(x -> System.out.println(currentThread().getName() + " " + x))
.subscribe();
-----------------------
main test
my-scheduler-1 test
How can I switch back to the main thread pool / scheduler that is used by default in Spring Webflux app (usually it appears with "main" in its name)?