RestController

It's a convenient annotation that combines @Controller and @ResponseBody, which eliminates the need to annotate every request handling method of the controller class with the @ResponseBody annotation

So basically this declaration

@RestController
public class RestDemoController {

}

Is the same as

@Controller
@ResponseBody
public class RestDemoController {

}

Which is the same as

@Component
@ResponseBody
public class RestDemoController {

}