Spring MVC

Learn about a few interview questions regarding Spring MVC.

What is Spring MVC?

Spring MVC is the module of Spring that implements the front controller and MVC design pattern. It provides a decoupled approach to developing web applications.

In Spring MVC, the three components of the MVC architecture, the front controller, view resolver and model are not dependent on each other. All incoming requests are handled by the front controller which is called the DispatcherServlet.

What are the advantages of using Spring MVC?

  • Spring MVC is based on interfaces which are independent of each other allowing separation of concerns.
  • Because there is no explicit dependency between the interfaces, Spring MVC applications are easily testable.
  • The view technology is customizable and switching between JSP, Velocity or Thymeleaf etc. can be done easily.
  • Spring MVC supports RESTful web services.

What is the flow of request in the MVC architecture?

The dispatcher servlet is the front controller which receives all requests from the client. It has a mapping of all controllers and maps the incoming request to the appropriate controller.

The ...