Using RouterFunction and HandlerFunction
The previous recipes have shown us how to establish a reactiveApplicationContext
and how Spring Boot 2.0 manages to run this reactive platform using a reactive embedded Tomcat server. This recipe will add another main feature of Spring 5 that is about building non-blocking, asynchronous, and context-independent Request-Response transactions using the functional web framework, a technique of writing a reactive version of @Controller
and its mappings, using a domain-specific language way.
Getting started
Open the standalone Spring Boot ch09-flux
project and add the following: RouterFunction<?>
and HandlerFunction<?>.
How to do it...
Let us implement reactive services using HandlerFunction<T>
and RouterFunction<T>
. Follow these steps:
- Before anything else, implementing a functional web framework means there will be a need to set up and configure another reactive embedded server that will execute and run these independent services....