Reactive API Service — Using Spring Webflux and Reactive Data Redis

  1. Simple user-service webflux API.
  2. Adding maven dependencies for both the spring-webflux and reactive data Redis.
  3. Project architecture and structure
  4. Adding the Spring and the Redis properties to the project properties file.
  5. Adding the User model/entity class.
  6. Configuring Reactive Redis with Lettuce Connection factory and Redis serialization.
  7. Implementing ReactiveCrudRepository interface and integrating it with Reactive Data Redis.
  8. Designing deligating service and controller layers.
  9. Writing the persistence tests to test the implemented UserRepository.
  10. Conclusion.
https://start.spring.io — Spring initializr
<dependency>   
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis-reactive</artifactId> </dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId> </dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-test</artifactId>
<scope>test</scope>
</dependency>
<!-- Embedded Redis for testing purposes-->
<dependency>
<groupId>it.ozimov</groupId>
<artifactId>embedded-redis</artifactId>
<version>0.7.3</version>
<scope>test</scope>
</dependency>
<dependency>   
<groupId>it.ozimov</groupId>
<artifactId>embedded-redis</artifactId>
<version>0.7.3</version>
<scope>test</scope>
</dependency>
Project structure
application.yaml — Application properties file

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Habeeb Okunade

Habeeb Okunade

Innovative software development professional. Loves sharing knowledge and learning latest stacks. Expertise in microservices architecture using spring boot.