From the course: Spring Data
Unlock this course with a free trial
Join today to access over 25,500 courses taught by industry experts.
Is it beautiful? - Spring Tutorial
From the course: Spring Data
Is it beautiful?
- We completed our refactoring, but is it beautiful? Let's look at some statistics. Just by leveraging JPA repositories, over 200 lines of code have been eliminated. For example, StaffDao had seven complicated methods. StaffRepo replaced it with all the baked-in JPA repository CRUD methods, and one easy to understand query method. We also were able to eliminate all of this configuration code to set up entity manager factory, the data source, transaction manager, and the H2 connection properties. Replacing it with the Spring Boot and Spring Data starter dependency and the Spring Boot application annotation. As an added bonus, now our application is part of the Spring Boot ecosystem, making it easy to integrate with other Spring Boot modules. We did it, congratulations. We accomplished our goal to make beautiful code. Now let's look at more Spring Data features.