Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

How does spring data rest work with spring data?


Asked by Joyce Foley on Dec 12, 2021 Spring



Spring Data REST is part of the umbrella Spring Data project and makes it easy to build hypermedia-driven REST web services on top of Spring Data repositories. Spring Data REST builds on top of Spring Data repositories, analyzes your application’s domain model and exposes hypermedia-driven HTTP resources for aggregates contained in the model.
Furthermore,
Spring Data REST takes the features of Spring HATEOAS and Spring Data JPA and combines them together, using a Strategy called “RepositoryDetectionStrategy” to export the repository as a REST resource. In this Spring Data REST Example, let’s create a Spring Boot RESTful API and perform CRUD Operations
And, Spring-data-jpa is the spring way to access data using JPA. You could use spring-data-rest on top of spring-data-jpa to create a REST-API layer with no code on top of your repositories and entities. And what spring-data-rest can do for you is just amazing. It is the fastest way to create a REST API on top of your JPA layer.
Moreover,
@Id and @GeneratedValue are JPA annotations to note the primary key and that is generated automatically when needed. This entity is used to track employee information — in this case, their names and job descriptions. Spring Data REST is not confined to JPA. It supports many NoSQL data stores, though you will not see those in this tutorial.
Thereof,
HATEOAS principle is that each resource should have its own URI / endpoint and it is the basic rule which all the RESTful Web Services must follow. Spring Data REST automagically creates a Spring REST Web Service without the need for us to explicitly write one.