Skip to content

hantsy/spring-reactive-sample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spring Reactive Sample

This is a sandbox project for demonstrating Reactive Streams support in Spring framework and Spring ecosystem.

I've also maintained a series of repos related to ReativeStreams and the latest Spring 5.

The source codes are updated to Spring 6/Spring Boot 3.0, the Spring Boot 2.7.x based codes are available in a compressed archive and tagged with v1.0.

Docs

Read online: https://hantsy..io/spring-reactive-sample/

Sample Codes

The following table list all sample codes related to the above posts.

Spring Samples

namedescription
vanillaThe initial application, includes basic spring-webflux feature, use a main class to start up the application
vanilla-reactor-netty2Same as vanilla, but use Reactor Netty5 2.x as target runtime
vanilla-jettySame as vanilla, but use Jetty as target runtime
vanilla-tomcatSame as vanilla, but use Reactor Netty as target runtime
vanilla-undertowSame as vanilla, but use Undertow as target runtime
java8Java 8 CompletableFuture and @Async example
java9Same 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
rxjava3Same as vanilla, but use Rxjava3 instead of Reactor, since Spring 5.3.0
smallrye-mutinySame as vanilla, but use SmallRye Mutiny instead of Reactor, since Spring 5.3.10
warReplace 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.
routesUse RouterFunction instead of controller in vanilla
register-beanProgrammatic approach to register all beans in ApplicatonContext at the application bootstrap
data-elasticsearchSpring Data ElasticSearch Reactive example
data-neo4jSpring Data Neo4j reactive example
data-mongoSpring Data Mongo Reactive example
data-mongo-pageableSpring Data Mongo Reactive example with pagination support
data-mongo-transactionSpring Data Mongo Reactive example with Transaction support
data-redisSpring Data Redis Reactive example
data-redis-messageSpring Data Redis Reactive Example with ReactiveRedisMessageListenerContainer
data-cassandraSpring Data Cassandra Reactive example
data-couchbaseSpring Data Couchbase Reactive example
securityBased on vanilla, add Spring Security Reactive support
security-formSame as security, login form example
security-user-propertiesSame as security, but use users.properties to store users
security-methodReplace URI based configuration with method level constraints
security-data-mongoBased on data-mongo and security, replace with dummy users in hard codes with Mongo driven store
multipartMultipart request handling and file uploading
multipart-data-mongoMultipart and file uploading, but data in Mongo via Spring Data Mongo Reactive GridFsTemplate
mvc-thymeleafTraditional web application, use Thymeleaf as template engine
mvc-mustacheTraditional web application, use Mustache as template engine
mvc-freemarkerTraditional web application, use freemarker as template engine
sseServer Send Event example
websocketWebSocket example
websocket-reactor-netty2WebSocket example with Reactor Netty2
web-filterWebFilter example
groovyWritten in groovy
groovy-dslGroovy DSL bean definition example
clientExample of WebClient to shake hands with backend reactive APIs
client-jettyExample of WebClient with Jetty Reactive HttpClient
client-reactor-netty2Example of WebClient with Reactor Netty5 2.x HttpClient
client-jdk11-httpclientExample of WebClient with JDK 11 HttpClient
client-apache-httpclient5Example of WebClient with Apache HttpClient5
cacheExample of Cache Aync/Reactive support(with in-memory ConcurrentHashMap)
cache-caffeineExample of Cache Aync/Reactive support with Caffeine
cache-redisExample of Cache Aync/Reactive support with Redis
eventApplication Event Reactive Example
kotlinWritten in kotlin
kotlin-coWritten in kotlin Coroutines
kotlin-routesUse kotlin functional approach to declare beans and bootstrap the application programmatically
kotlin-dslKotlin DSL bean definition example
scheduleSpring Schedule Reactive Example
sessionSpring Session Example
session-headerSpring Session WebSessionIdResolver Example
session-data-redisSpring Data Redis based ReactiveSessionRepository Example
session-data-mongoSpring Data Mongo based ReactiveSessionRepository Example
exception-handlerException Handler Example
integrationSpring Integration Example
integration-dslSpring Integration Java 8 DSL Example
restdocsSpring RestDocs Example

Spring Boot Samples

namedescription
boot-startSpring Boot example, including 3 Maven profiles to switch to Jetty, Tomcat, Undertow as target runtime
boot-start-routesSimple RouterFunction example
boot-mvc-thymeleafSame as mvc-thymeleaf, but based on Spring Boot
boot-mvc-mustacheSame as mvc-mustache, but based on Spring Boot
boot-mvc-freemarkerSame as mvc-freemarker, but based on Spring Boot
boot-groovyWritten in Groovy
boot-kotlinWritten in Kotlin
boot-kotlin-coWritten in Kotlin Coroutines
boot-kotlin-dslKotlin specific BeanDefinitionDSL and RouterFunctionDsl Example
boot-kotlin-co-dslKotlin specific BeanDefinitionDSL, CoRouterFunctionDsl Example
boot-redisExample of using ReactiveRedisConnection and RouterFunction
boot-data-redisSpring Data Redis Example
boot-data-neo4jSpring Data Neo4j example (Spring Boot 2.4)
boot-neo4jSpring Data Neo4j using ReactiveNeo4jOperations (Spring Boot 2.4)
boot-neo4j-cypherSpring Data Neo4j using ReacitveNeo4jClient (Spring Boot 2.4)
boot-data-cassandraSpring Data Cassandra Example
boot-data-couchbaseSpring Data Couchbase Example
boot-data-elasticsearchSpring Data ElasticSearch Example
boot-data-mongoSpring Data Mongo Example(Repository, Auditing, testcontainers)
boot-data-mongo-querydslSpring Data Mongo Example with QueryDSL support
boot-data-mongo-gridfsSpring Data Mongo Example with Gridfs support
boot-data-mongo-tailableSpring Data Mongo tailable document example
boot-exception-handlerGlobal Exception Handler
boot-pulsarSpring for Pulsar Reactive Example

Legacy Codes

Some example codes are becoming deprecated as time goes by, eg. the SDN Rx project which was maintained by the Neo4j team is discontinued now, it is highly recommended to migrate to the official Spring Data Neo4j.

And Spring Data R2dbc 1.2 added a lot of breaking changes, so I created another Spring R2dbc Sample repository to introduce the new features.

Spring removed support of RxJava/RxJava2, and other projects, such as Spring Data will remove RxJava/RxJava2 support soon.

namedescription
data-r2dbcSpring Data R2dbc Example. (Deprecated, go to hantsy/spring-r2dbc-sample to update yourself)
data-r2dbc-postgresqlSpring Data R2dbc Example, but use PostgreSQL instead(Deprecated)
boot-r2dbcSpring Data R2dbc example using DatabaseClient(Deprecated)
boot-data-r2dbcSpring Data R2dbc example(Deprecated)
boot-data-r2dbc-auditing@EnableR2dbcAuditing example(Deprecated)
boot-data-r2dbc-postgresqlSame as boot-data-r2dbc, but use PostgresSQL instead(Deprecated)
boot-data-r2dbc-mysqlSame as boot-data-r2dbc, but use MySQL instead(Deprecated)
boot-data-r2dbc-mssqlSame as boot-data-r2dbc, but use MS SQL instead(Deprecated)
boot-neo4j-rxSDN Rx Example but use ReactiveNeo4jClient(Deprecated)
boot-neo4j-rx-cypherSDN Rx Example using Cypher queries(Deprecated)
boot-data-neo4j-rxSDN Rx Example(Deprecated)
rxjavaSame as vanilla, but use Rxjava instead of Reactor
rxjava-jdbcAccessing database with rxjava-jdbc. NOTE: rxjava-jdbc is a wrapper of blocking Jdbc APIs
rxjava2Same as vanilla, but use Rxjava2 instead of Reactor
rxjava2-jdbcAccessing database with rxjava2-jdbc. NOTE: rxjava2-jdbc is a wrapper of blocking Jdbc APIs

References

Special Thanks

Specials thanks for Jetbrains's support by contributing an open-source license.