@GetMapping

Learn how to create a GET mapping in the REST service that returns a list of POJOs as JSON.

Starting from this lesson, we will build a REST service that provides basic CRUD functionality. The client sends an HTTP request to the REST service. The dispatcher servlet handles the request and if the request has JSON data, the HttpMessageConverter converts it to Java objects. The request is mapped to a controller which calls service layer methods. The service layer delegates the call to repository and returns the data as POJO. The MessageConverter converts the data to JSON and it is sent back to the client. The flow of request is shown below:

Press + to interact
REST service architecture
REST service architecture

In this lesson, we will create an endpoint for retrieving the list of players from the database. The REST client will send a ...

Access this course and 1400+ top-rated courses and projects.