This is a sample application using Spring Boot 2 with Spring Webflux.
In order to get started with this sample application you need to install JDK 9. You can use SDKMAN! for that if you want.
The application need a running MongoDB instance, the easiest way to start one, is through docker
docker run --name some-mongo mongo
Then you need to get the IP address of the mongo container
docker inspect --format '{{ .NetworkSettings.IPAddress }}' some-mongo
If the IP address is not 172.17.0.2
, then you must change the IP address specified in the file src/main/resources/application-local.yml
under the key spring.data.mongodb.host
spring:
data:
mongodb:
host: 172.17.0.2
In order to start the sample application just call
./gradlew bootRun
or on Windows
./gradlew.bat bootRun
You can use an IDE to look at the source code, I recommend the Spring Tool Suite, but you use any IDE that you see fit.
These example requests are issued through HTTPie.
http -v -a user:user :8080/customers/
http -v -a user:user :8080/customers/ size==2 page==1
http -v -a user:user :8080/customers/5acb629d859c16689db5f091
http -v -a admin:admin POST :8080/customers/ firstName=Daenerys lastName=Targaryen
http -v -a admin:admin DELETE :8080/customers/5ae2ef2a7593241a65e2b961
http --stream -v -a user:user :8080/customers/stream 'Accept: text/event-stream'