Skip to main content


Showing posts from August 8, 2022

Reactive Spring - CRUD with MongoDB

Greetings! When we learn something, it is good to have something to play with. Now is the time to connect with a database. Working with Reactive Programming is fun but it brings extra challenges. Connecting to a database is such a challenge as we can't use blocking drivers. Lucky for us, Spring comes with Data Repository for MongoDB. Assumptions: You are comfortable with Spring Boot REST You have installed or have access to the MongoDB database The completed project is here -  reactive-super-heroes What to expect? We will follow Spring's usual layers. The main difference is we are using a Reactive Repository instead of the usual blocking repository. We will build a simple REST application with CRUD operations to store superheroes. Create the project Add database connection Create entity (document), dtos Create repository Create service Create controller Demo Create the project Go to and create a project with the below dependencies. S