Spring / Spring Interview questions II
Difference between @Controller and @RestController annotation in Spring MVC.
@Controller denotes that the marked class is a Spring MVC Controller.
@RestController is nothing but a combination of @Controller and @ResponseBody annotations. @RestController annotation marks any class as @Controller and in addition to that it annotates the class with the @ResponseBody annotation.
The following controller definitions are functionally equal.
@Controller @ResponseBody public class MVCController { } @RestController public class MVCController { }
More Related questions...