Spring Boot Data Repository

Learn to create persistence tier and perform database operation using Spring Boot Starter JPA with less code and a pre-configured entity manager.

In the previous chapter, we migrated our old school Billionaire’s Club application to leverage Spring Data JPA.

In this chapter, we will upgrade our Elite Club application to use Spring Ddata JPA.

Problem

Our first version of the Elite Club application works fine.

Now we are seeing recurring requests from customers to add and delete new clubs. Our existing design of the application is not adaptable enough to cater to such requirements. Because club lists are hardcoded in the service class, we’d have to redeploy our application every time there are new requests.

Let’s upgrade our application.

Solution

Yes, we can keep that information in DB. When requested, we can add a new entry to our table.

  • We need to design a persistence layer. Let’s do it with Spring Data JPA.

Step1 - Add Maven dependency

As our application uses Spring Boot, why not use one of the starter libraries which enables Springdata? We need to add the below dependency in our Maven POM. . We need to add the below dependency in our maven pom.

 <dependency>
 <groupId>org.springframework.boot</groupId>
...