@Controller
@RestController
@Controller is used to mark classes as Spring MVC Controller. @RestController annotation is a special controller used in RESTful Web services, and it’s the combination of @Controller and @ResponseBody annotation.
It is a specialized version of @Component annotation. It is a specialized version of @Controller annotation.
In @Controller, we can return a view in Spring Web MVC. In @RestController, we can not return a view.
@Controller annotation indicates that the class is a “controller” like a web controller. @RestController annotation indicates that class is a controller where @RequestMapping methods assume @ResponseBody semantics by default.
In @Controller, we need to use @ResponseBody on every handler method. In @RestController, we don’t need to use @ResponseBody on every handler method.
It was added to Spring 2.5 version. It was added to Spring 4.0 version.