Creating the final data access layer
We have played with the Spring Data JPA project, and we have seen how easy it can be. We learned how to configure the database connections to persist the real data on the Postgres database. Now, we will create the final solution for the data access layer for our application. The final solution will use MongoDB as a database and will use the Spring Data MongoDB project, which provides support for MongoDB repositories.
We will see some similarities with the Spring Data JPA projects. It is amazing because we can prove the power of Spring Data abstractions in practice. With a couple of changes, we can move to another database model.
Let's understand the new project and put it into practice in the following sections.
Spring Data MongoDB
The Spring Data MongoDB provides integration with our domain objects and the MongoDB document. With a couple of annotations, our entity class is ready to be persisted in the database. The mapping is based on a POJO (Plain Old Java...