@RestController marks a Spring class whose methods handle HTTP requests and directly return the response body, serialized as JSON, rather than a view name. It combines @Controller and @ResponseBody. It is used to write REST APIs.
Example
@RestController
class ClientController {
@GetMapping("/clients") List<Client> liste() { return service.tous(); }
}