Spring5 Functional Web Framework Sample.
The project is a sample application that uses the functional web framework introduced in Spring 5.
Build
Use maven to build this project:
mvn clean instalThe structure of the project
Controller module contains
UserControllerclass with router functions.Application- starts as SpringBoot Application with Netty server.
Repository module contains
UserPOJO objectUserRepositoryMongo reactive crud repository class.
Server module contains
TomcatServer. Contains amainmethod to start the server using Tomcat server.NettyServer. Contains amainmethod to start the server using Reactor Netty server.Client. Contains amainmethod to start the client.
Running
As spring boot application
- Run the
Applicationclass
Reactor Netty server
- Run the
NettyServerclass
Tomcat server
- Run the
TomcatServerclass
Client
- Run the
Clientclass
Usage
Sample curl commands
Instead of running the client, here are some sample curl commands that access resources exposed
by this sample:
Retrieve list of users
curl -v 'http://localhost:8080/users'Retrieve user by id
curl -v 'http://localhost:8080/user/{id}'Create new user
curl -d '{"name":"Jack Doe"}' -H 'Content-Type: application/json' -v 'http://localhost:8080/user'