SPRING BOOT IN CHENNAI

Ifrana Rukkaiya
1 min readMar 22, 2021

Spring Boot Model

The model is represented by Model, ModelMap, and ModelAndView in Spring.

Spring is a popular Java application framework and Spring Boot is an evolution of Spring that helps create stand-alone, production-grade Spring-based applications easily.
MVC
MVC (Model-View-Controller) is a software architecture pattern, which separates an application into three parts: model, view, and controller. The model represents a Java object carrying data. The view visualizes the data that the model contains. The controller manages the data flow into the model object and updates the view whenever data changes; it keeps the view and model separate.
Spring MVC
Spring MVC is the original web framework built on the Servlet API. It is built on the MVC design pattern.
Model, ModelMap, ModelAndView
It’s used to define a model in a Spring MVC application. The model defines a holder for model attributes and is primarily designed for adding attributes to the model. ModelMap is an extension of the Model with the ability to store attributes in a map and chain method calls. ModelAndView is a holder for a model and a view; it allows to return both model and view in one return value.
Spring Boot Model example
The following simple web application uses Model, ModelMap, and ModelAndView in the controller methods. The model holds application data, which is displayed in the view.

--

--