0 votes
in Spring by

What is a Controller in Spring MVC?

1 Answer

0 votes
by

Just like MVC design pattern, Controller is the class that takes care of all the client requests and send them to the configured resources to handle it. In Spring MVC, org.springframework.web.servlet.DispatcherServlet is the front controller class that initializes the context based on the spring beans configurations.

A Controller class is responsible to handle a different kind of client requests based on the request mappings. We can create a controller class by using @Controller annotation. Usually, it’s used with @RequestMapping annotation to define handler methods for specific URI mapping.

Related questions

0 votes
asked Apr 4, 2021 in Spring by Robindeniel
0 votes
asked Jul 28, 2020 in Spring by sharadyadav1986
...