This recipe is the only way of building a 100% reactive Spring 5 web application wherein the org.springframework.web.reactive.config.DelegatingWebFluxConfiguration is injected into the container by Spring Boot and @Autowire it to the constructor of AnnotationConfigServletWebServerApplicationContext to generate a reactive web MVC configuration. The following bootstrap log from /logs/ch09.log will give us proof that the process really occurs with Spring Boot 2.0:
07:35:22.558 [localhost-startStop-1] INFO o.s.b.f.s.DefaultListableBeanFactory - Overriding bean definition for bean 'requestMappingHandlerMapping' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.web.servlet.config.annotation.DelegatingWebMvcConfiguration; factoryMethodName=requestMappingHandlerMapping; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/web/servlet/config/annotation/DelegatingWebMvcConfiguration.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.web.reactive.config.DelegatingWebFluxConfiguration; factoryMethodName=requestMappingHandlerMapping; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/web/reactive/config/DelegatingWebFluxConfiguration.class]]
Because of this process, Spring Boot allows automatic recognition of thread pools generated by TaskExecutor and also allows assignment of each thread to different @Async, Callable, DeferredResult, Flux<T>, and Mono<T> operations. Likewise, the integration of RxJava 2.x does not require further property configuration details because the new web platform is now totally reactive. At this point, we have a working Spring WebFlux with a reactive platform built by Spring Boot 2.0 from the ground up.