-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

Hands-On Microservices with Kotlin
By :

So far, we have learned how to create our reactive microservices with an annotation based syntax almost identical to the non-reactive approach. However, Spring Framework 5 provides a mechanism to develop these microservices using functional programming. In this section, we will learn how we can use it to explore a more flexible and modern syntax.
We will use the example already created in the previous section of this chapter, so follow the steps to get started.
As with the annotated base system, first we need to define how our microservice will handle incoming requests, but instead of creating a controller, we will use a RouterFunction
.
First, we will create a new class named CustomerRouter
, with a RouterFunction
:
package com.microservices.chapter4 import org.springframework.context.annotation.Bean import org.springframework.stereotype.Component import org.springframework.web.reactive.function.server.RouterFunction import org.springframework...