Spring Data JPA is a data provider, not a JPA provider, and it's a library/framework that sits on top of our JPA provider and offers an extra layer of abstraction. If we choose to use Spring Data JPA, our application's repository layer will consist of three layers, as shown below:
By extending the Spring Data repository interfaces, Spring Data JPA supports establishing JPA repositories.
Spring Data Commons provides the infrastructure shared by the datastore-specific Spring Data projects. The JPA provider implements the Java Persistence API.
Spring Data JPA appears to make our program more complicated at first glance, and in some ways, this is correct. It adds another layer to our repository, but it also saves us from writing any boilerplate code.
You don't have to write the before and after code for persisting, updating, deleting, or searching an object, such as creating Persistence instance, EntityTransaction instance, EntityManagerFactory instance, committing EntityTransaction instance, EntityManager instance, and closing EntityManager instance.
As a result, it saves a lot of code.
By following these steps, we can create the configuration class that configures a Spring application's persistence layer: