https://github.com/qvest-digital/spring-boot2-sample-webflux
Simple sample Spring Boot 2 application with Webflux
https://github.com/qvest-digital/spring-boot2-sample-webflux
spring-boot-2 spring-data-mongodb-reactive spring-security spring-webflux
Last synced: 3 months ago
JSON representation
Simple sample Spring Boot 2 application with Webflux
- Host: GitHub
- URL: https://github.com/qvest-digital/spring-boot2-sample-webflux
- Owner: qvest-digital
- License: apache-2.0
- Created: 2018-05-07T13:22:43.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-05-17T07:50:02.000Z (about 7 years ago)
- Last Synced: 2023-11-28T15:58:18.383Z (over 1 year ago)
- Topics: spring-boot-2, spring-data-mongodb-reactive, spring-security, spring-webflux
- Language: Java
- Size: 66.4 KB
- Stars: 3
- Watchers: 9
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.adoc
- License: LICENSE
Awesome Lists containing this project
README
= Spring Boot 2 Sample Webflux Application
This is a sample application using Spring Boot 2 with Spring Webflux.
== Getting stated
=== JDK 9
In order to get started with this sample application you need to install JDK 9. You can use http://sdkman.io/[SDKMAN!] for that if you want.
=== MongoDB
The application need a running MongoDB instance, the easiest way to start one, is through docker
[source, bash]
----
docker run --name some-mongo mongo
----Then you need to get the IP address of the mongo container
[source, bash]
----
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`
[source, yaml]
----
spring:
data:
mongodb:
host: 172.17.0.2
----=== Start the application
In order to start the sample application just call
[source, bash]
----
./gradlew bootRun
----or on Windows
[source, bash]
----
./gradlew.bat bootRun
----=== IDE
You can use an IDE to look at the source code, I recommend the https://spring.io/tools[Spring Tool Suite], but you use any IDE that you see fit.
== Useful links
* https://www.reactivemanifesto.org/[The Reactive Manifesto]
* http://projectreactor.io/docs/core/release/reference/[Reactor 3 Reference Guide]
* https://docs.spring.io/spring/docs/5.0.5.RELEASE/spring-framework-reference/web-reactive.html#webflux[Spring WebFlux documentation]
* https://docs.spring.io/spring-data/mongodb/docs/2.0.7.RELEASE/reference/html/#mongo.reactive[Spring Data MongoDB Reactive support]
* https://docs.spring.io/spring-security/site/docs/current/reference/html5/#jc-webflux[Spring Security WebFlux support]
* https://docs.spring.io/spring-security/site/docs/current/reference/html5/#test-webflux[Spring Security WebFlux testing support]== Example requests
These example requests are issued through https://httpie.org/[HTTPie].
.GET a list of customers
[source, bash]
----
http -v -a user:user :8080/customers/
----.GET a list of customers with paging
[source, bash]
----
http -v -a user:user :8080/customers/ size==2 page==1
----.GET a customer by id
[source, bash]
----
http -v -a user:user :8080/customers/5acb629d859c16689db5f091
----.CREATE a customer
[source, bash]
----
http -v -a admin:admin POST :8080/customers/ firstName=Daenerys lastName=Targaryen
----.DELETE a customer by id
[source, bash]
----
http -v -a admin:admin DELETE :8080/customers/5ae2ef2a7593241a65e2b961
----.Stream customers
----
http --stream -v -a user:user :8080/customers/stream 'Accept: text/event-stream'
----