Spring Data REST - Introduction



As we have learned in the previous chapter of Spring Data JPA that it simplifies the data access layer, which says that if we want to implement a data access layer then simply create a JPA entity followed by creating a repository that will extend CrudRepository.

Spring Data REST took this to the next level by exposing out all the operation of a repository i.e., save (), delete (), findOne (), findAll () as RESTful resources. Spring Data REST says that without writing any controller and other code and by simply writing a JPA entity and creating an interface and extending a CrudRepository you can expose your database entity as a RESTful resource. Not only this, you will be having HAL and HATEOAS support as well. You are not required to write any custom logic for all this work.

In short Spring Data REST is one of the modules of the Spring Data project. It provides us to build hypermedia−driven RESTful services and it works on top of Spring Data repositories. It scans and analyses our application domain model and generates hypermedia−driven HTTP resources for our web services.

Advertisements