What is controller in spring?
Category:
technology and computing
programming languages
Controller - A controller contains the business logic of an application. Here, the @Controller annotation is used to mark the class as the controller. Front Controller - In Spring Web MVC, the DispatcherServlet class works as the front controller. It is responsible to manage the flow of the Spring MVC application.
Also, what is rest controller in spring?
Spring RestController annotation is a convenience annotation that is itself annotated with @Controller and @ResponseBody . Spring RestController annotation is used to create RESTful web services using Spring MVC. Spring RestController takes care of mapping request data to the defined request handler method.
Correspondingly, what are the types of controller in spring?
Here is the list of anstract controllers that comes with the Spring MVC module:
- SimpleFormController.
- AbstractController.
- AbstractCommandController.
- CancellableFormController.
- AbstractCommandController.
- MultiActionController.
- ParameterizableViewController.
- ServletForwardingController.
Difference between @RestController and @Controller in Spring. The @Controller is a common annotation which is used to mark a class as Spring MVC Controller while @RestController is a special controller used in RESTFul web services and the equivalent of @Controller + @ResponseBody.