From the course: Spring Data

Unlock this course with a free trial

Join today to access over 25,500 courses taught by industry experts.

Spring Data REST

Spring Data REST - Spring Tutorial

From the course: Spring Data

Spring Data REST

- [Instructor] Spring Data REST is a module for exposing Spring data repositories as hypermedia-driven RESTful web services. And that's actually pretty amazing. Similar to Spring Data Commons, which extrapolates the underlying backend store services from a CRUD repository, Spring Data REST exposes those same repositories as web services with no coding or extra configuration. All we need to do is add the Spring Data REST Starter dependency to our pom, rebuild the application, and start it. And that's when the magic happens. At application startup after bootstrap, Spring Data REST finds the JPA entities that have the spring data repositories, creates an endpoint that matches that entity name, appends an s to the endpoint, and exposes the method as a RESTful resource API over HTTP. So, let's see how HTTP verbs GET, POST, PUT, PATCH, and DELETE are mapped to the repository methods findAll, findById, and the custom query methods mapped to HTTP GET. So, for example, let's say that our…

Contents