16 Working with Spring Data REST


This chapter covers

  • Introducing REST applications
  • Creating a Spring Data REST application
  • Using ETags for conditional requests
  • Limiting the access to repositories, methods, and fields
  • Working with REST events
  • Using projections and excerpts

Representational state transfer (REST) is a software architectural style for creating web services; it also provides a set of constraints (to be detailed in the next section). The American computer scientist Roy Fielding, who is also one of the authors of the HTTP specification, first defined REST, presenting the REST principles in his PhD dissertation in 2000 (https://www.ics.uci.edu/~fielding/pubs/dissertation/top.htm). Web services following this REST architectural style are called RESTful web services. RESTful web services allow interoperability between the internet and computer systems. Requesting systems can access and manipulate web resources represented as text using a well-known set of stateless operations (GET, POST, PUT, PATCH, DELETE). A stateless operation does not depend on any other prior operation, it must contain all the information needed to be understood by the server.

16.1 Introducing REST applications

16.2 Creating a Spring Data REST application

16.3 Using ETags for conditional requests

16.4 Limiting the access to repositories, methods, and fields

16.5 Working with REST events

16.5.1 Writing an AnnotatedHandler

16.5.2 Writing an ApplicationListener

16.6 Using projections and excerpts

16.7 Summary