The Idea

Used to abstract the data layer

Using the repository design pattern decouples business logic from data access code making code more maintainable. Provides a simple interface for a table. Repositories can make unit testing easier because you can inject mock repositories that mimic data operations without relying on a database. Springs JPA repositories also come with useful syntax for implementing method-based-queries.