Creating a REST Controller
Learn how to create a controller to map requests to our REST API.
We'll cover the following
In this lesson, we will create a REST service with a request mapping /welcome
and send it a request from a REST client (web browser or Postman). The service will respond with a welcome message.
@RestController
First, we will create a controller class called PlayerController
with the @RestController
annotation. This annotation is an extension of @Controller
annotation. The @RestController
annotation has support for REST requests and responses and automatically handles the data binding between the Java POJOs and JSON.
Get hands-on with 1400+ tech skills courses.