Spring Reactive Sample
This is a sandbox project for examplenstrating Reactive Streams support in Spring framework and its ecosystem.
I've also maintained a series of repos related to ReativeStreams and the latest Spring 5.
- Spring RSocket Sample
- Spring Kotlin Coroutines Example
- Spring Kotlin DSL/Spring Fu Sample
- Spring WebMvc Functional Example
- Angular and Spring Reactive Example
Docs
- Reactive Programming with Spring 5(Deprecated)
- Accessing Neo4j with SDN Rx
- Accessing RDBMS with Spring Data R2dbc
Sample Codes
The following table list all sample codes related to the above posts.
Spring Samples
| name | description |
|---|---|
| vanilla | The initial application, includes basic spring-webflux feature, use a main class to start up the application |
| vanilla-jetty | Same as vanilla, but use Jetty as target runtime |
| vanilla-tomcat | Same as vanilla, but use Reactor Netty as target runtime |
| vanilla-undertow | Same as vanilla, but use Undertow as target runtime |
| java8 | Java 8 CompletableFuture and @Async example |
| java9 | Same as vanilla, Java 9 Flow API support is not ready in Spring 5.0.0.REALESE, planned in 5.0.1, see issue SPR-16052 and the original discussion on stackoverflow |
| rxjava | Same as vanilla, but use Rxjava instead of Reactor |
| rxjava-jdbc | Accessing database with rxjava-jdbc |
| rxjava2 | Same as vanilla, but use Rxjava2 instead of Reactor |
| rxjava2-jdbc | Accessing database with rxjava2-jdbc |
| war | Replace the manual bootstrap class in vanilla with Spring ApplicationInitializer, it can be packaged as a war file to be deployed into an external servlet container. |
| routes | Use RouterFunction instead of controller in vanilla |
| register-bean | Programmatic approach to register all beans in ApplicatonContext at the application bootstrap |
| data-mongo | Spring Data Mongo Reactive example |
| data-mongo-pageable | Spring Data Mongo Reactive example with pagination support |
| data-mongo-transaction | Spring Data Mongo Reactive example with Transaction support |
| data-redis | Spring Data Redis Reactive example |
| data-redis-message | Spring Data Redis Reactive Example with ReactiveRedisMessageListenerContainer |
| data-cassandra | Spring Data Cassandra Reactive example |
| data-couchbase | Spring Data Couchbase Reactive example |
| data-r2dbc | Spring Data R2dbc Example |
| data-r2dbc-postgresql | Spring Data R2dbc Example, but use PostgreSQL instead |
| security | Based on vanilla, add Spring Security Reactive support |
| security-form | Same as security, login form example |
| security-user-properties | Same as security, but use users.properties to store users |
| security-method | Replace URI based configuration with method level constraints |
| security-data-mongo | Based on data-mongo and security, replace with dummy users in hard codes with Mongo driven store |
| multipart | Mutipart request handling and file uploading |
| multipart-data-mongo | Multipart and file uploading, but data in Mongo via Spring Data Mongo Reactive GridFsTemplate |
| mvc-thymeleaf | Traditional web application, use Thymeleaf as template engine |
| mvc-mustache | Traditional web application, use Mustache as template engine |
| mvc-freemarker | Traditional web application, use freemarker as template engine |
| sse | Server Send Event example |
| websocket | WebSocket example |
| web-filter | WebFilter example |
| groovy | Written in groovy |
| groovy-dsl | Groovy DSL bean definition example |
| client | examplenstration of WebClient to shake hands with backend reactive APIs |
| kotlin | Written in kotlin |
| kotlin-routes | Use kotlin functional approach to declare beans and bootstrap the application programmatically |
| kotlin-dsl | Kotlin DSL bean definition example |
| session | Spring Session Example |
| session-header | Spring Session WebSessionIdResolver Example |
| session-data-redis | Spring Data Redis based ReactiveSessionRepository Example |
| session-data-mongo | Spring Data Mongo based ReactiveSessionRepository Example |
| exception-handler | Exception Handler Example |
| integration | Spring Integration Example |
| integration-dsl | Spring Integration Java 8 DSL Example |
| restdocs | Spring RestDocs Example |
Spring Boot Samples
| name | description |
|---|---|
| boot-start | Switch to Spring Boot to get autoconfiguration of Spring WebFlux |
| boot-start-routes | Simple RouterFunction example |
| boot-jetty | Example using Jetty as target runtime |
| boot-tomcat | Example using Tomcat as target runtime |
| boot-undertow | Example using Undertow as target runtime |
| boot-routes | RouterFunction CRUD Example |
| boot-mvc-thymeleaf | Same as mvc-thymeleaf, but based on Spring Boot |
| boot-mvc-mustache | Same as mvc-mustache, but based on Spring Boot |
| boot-mvc-freemarker | Same as mvc-freemarker, but based on Spring Boot |
| boot-groovy | Written in Groovy |
| boot-kotlin | Written in Kotlin |
| boot-kotlin-dsl | Kotlin specific BeanDefinitionDSL Example |
| boot-r2dbc | Spring Data R2dbc example using DatabaseClient |
| boot-data-r2dbc | Spring Data R2dbc example |
| boot-data-r2dbc-postgresql | Same as boot-data-r2dbc, but use PostgresSQL instead |
| boot-data-r2dbc-mysql | Same as boot-data-r2dbc, but use MySQL instead |
| boot-data-r2dbc-mssql | Same as boot-data-r2dbc, but use MS SQL instead |
| boot-neo4j-rx | Spring Data Neo4j Rx Example but use ReactiveNeo4jClient. |
| boot-neo4j-rx-cypher | Spring Data Neo4j Rx Example using Cypher queries |
| boot-data-neo4j-rx | Spring Data Neo4j Rx Example |
| boot-data-cassandra | Spring Data Cassandra Example |
| boot-data-couchbase | Spring Data Couchbase Example |
| boot-data-elasticsearch | Spring Data ElasticSearch Example |
| boot-data-mongo | Spring Data Mongo Example |
| boot-data-mongo-querydsl | Spring Data Mongo Example with QueryDSL support |
| boot-data-mongo-gridfs | Spring Data Mongo Example with Gridfs support |
| boot-exception-handler | Global Exception Handler |
References
-
Reactive Streams, official Reactive Streams website
-
Understanding Reactive types, Spring.IO
-
The WebFlux framework, Spring Framework Reference Documentation
-
Reactor Core 3.0 becomes a unified Reactive Foundation on Java 8, Spring.IO
-
Reactive Spring, Spring.IO
-
Three parts of Notes on Reactive Programming by Dave Syer:
-
Kotlin extensions for MongoOperations and ReactiveMongoOperations
Special Thanks
Specials thanks for Jetbrains's support by contributing an open-source license.


