Just a quick demo of one of the many ways to handle errors in a Spring WebFlux application.
The error handling bits are in the RoutesConfiguration
and ErrorHttpHandler
classes. There's also some error mapping in the UserHttpHandler
class.
The project includes a Gradle wrapper. To run the service locally, execute the following command from the root folder:
./gradlew bootRun
Then try some requests to the API:
GET /api/v1/users/1
GET /api/v1/users/9999