The Spring Web MVC framework uses the model-view-controller (MVC) architecture, which manages the web applications. This provides a ready component that can be used by developers to develop a robust and loosely-coupled web application. With the presentation of Spring 3.0, the @Controller component additionally enables you to make peaceful web locales and applications through the @PathVariable annotation and different features. The MVC pattern separates the different aspects, such as input, business, and UI logic of the application.
There are three parts to MVC:
- The model is at the core of MVC applications. This is where the primary logic and information objects that comprise the core usefulness of the application are produced.
- The view is the place the information given by the model is introduced to the client. A view regulates the visual (or other) interface components – it chooses, filters, and arranges data provided by the model.
- The controller is in charge of preparing client requests, building a proper model, and passing it to the view for rendering.
Here are some of the advantages of Spring MVC framework:
- Spring MVC helps to separate each role, such as the model object and controller.
- When developing and deploying an application, it helps developers to use the lightweight servlet container.
- It provides a robust and powerful configuration for the project.
- You can develop a project very quickly and in parallel.
- Testing is very easy and you can inject test data using a setter function.