SlideShare una empresa de Scribd logo
1 de 24
Descargar para leer sin conexión
Spring MVC
Presentation by
Hung Nguyen Huy
Content
1. HTTP Servlet (Review)
2. What is Spring MVC?
3. MVC Architecture
4. Request Processing Workflow in Spring MVC
5. Spring Web Application Context
6. Spring MVC Configuration
7. Important Annotations
8. Summary
HTTP Servlet (Review)
HTTP Servlets
● Are Java classes that run on Web
Servers to dynamically process HTTP
requests and construct HTTP
responses.
● Deployed inside a Servlet Container
which run on a Web Server.
● Tomcat is a popular Servlet Container.
Servlets Architecture
● Servlets act as a middle layer between a
Web browser and databases or
applications on the Web Server.
● The following diagram shows the
position of Servlets in a Web Application
What is Spring MVC ?
What is Spring MVC?
Modules of Spring Framework on the Web layer:
● Web module provides basic web-oriented integration
features and the initialization of the IoC container
using servlet listeners and a web application context.
● Servlet module contains Spring MVC
implementation for web applications.
What is Spring MVC ? (cont.)
● A web framework built on the Servlet API.
● Provides Model-View-Controller (MVC) architecture and ready
components that can be used to develop flexible and loosely coupled web
applications.
● Request-driven, designed around a central Servlet that dispatches
requests to controllers - the DispatcherServlet.
MVC
MVC (Model-View-Controller)
Introduced by Trygve Reenskaug at Xerox Parc in 1979.
MVC (Model-View-Controller)
● An architectural pattern commonly used
for developing user interfaces.
● An application is divided into 3
interconnected parts:
○ Model - Responsible for managing data
of the application.
○ View - Responsible for displaying the
model data to user.
○ Controller - Responsible for processing
user requests and building an
appropriate model and passes it to the
view for rendering.
Request Processing Workflow
in Spring MVC
Request Processing Workflow (High Level)
The request processing workflow in Spring Web MVC (high level)
DispatcherServlet
● Spring MVC is designed around a central
servlet named DispatcherServlet.
● DispatcherServlet acts as a central entry
point to the Spring MVC application.
● Every request is handled by
DispatcherServlet.
● DispatcherServlet is an expression of
the Front Controller pattern.
The request processing workflow in Spring Web MVC (high level)
Controllers
● The Front Controller’s job is to
determine a suitable handler capable of
performing the actual processing.
● Handlers are Spring MVC Controllers.
● The selected Controller interacts with
the service layer; the relevant data are
collected in a model.
● When the Controller has finished
processing, the Front Controller
determines which view to render.
The request processing workflow in Spring Web MVC (high level)
View
● When the Controller has finished
processing, the Front Controller
determines which view to render.
● The Front Controller passes the model
to the view which is finally which is
finally rendered on the browser.
The request processing workflow in Spring Web MVC (high level)
Request Processing Workflow (Details Level)
1. DispatcherServlet receives the request.
2. DispatcherServlet dispatches the task of selecting an
appropriate controller to HandlerMapping. HandlerMapping
selects the Controller which is mapped to the incoming request
URL and returns the (selected Handler) and Controller to
DispatcherServlet.
3. DispatcherServlet dispatches the task of executing of business
logic of Controller to HandlerAdapter.
4. HandlerAdapter calls the business logic process of Controller.
5. Controller executes the business logic, sets the processing
result in Model and returns the logical name of view to
HandlerAdapter.
6. DispatcherServlet dispatches the task of resolving the View
corresponding to the View name to ViewResolver.
ViewResolver returns the View mapped to View name.
7. DispatcherServlet dispatches the rendering process to
returned View.
8. View renders Model data and returns the response.
Web Application Context
Web Application Context
● DispatcherServlet expects a WebApplicationContext,
an extension of a plain ApplicationContext, for its own
configuration.
● WebApplicationContext has a link to the
ServletContext and Servlet it is associated with.
● The root WebApplicationContext typically contains
infrastructure beans such as data repositories and
business services which are inherited and could be
overridden in the Servlet WebApplicationContext.
● Servlet WebApplicationContext contains web-related
beans: such as controllers, handler mappings,...
Spring MVC Configurations
Spring MVC Configurations
Spring MVC supports 2 type of configurations:
● XML Configuration
● Java-based Configuration
Important annotations
Important annotations
Some important annotations which are used in a Spring MVC application.
● @Controller and @RestController
● @RequestMapping
○ @GetMapping, @PostMapping, @PutMapping and @DeleteMapping
● @RequestParam, @PathVariable
● @RequestBody
● @ResponseBody
Summary

Más contenido relacionado

La actualidad más candente

La actualidad más candente (20)

Spring Boot in Action
Spring Boot in Action Spring Boot in Action
Spring Boot in Action
 
Spring boot
Spring bootSpring boot
Spring boot
 
Spring mvc
Spring mvcSpring mvc
Spring mvc
 
Spring boot
Spring bootSpring boot
Spring boot
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring Framework
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 
Introduction to spring boot
Introduction to spring bootIntroduction to spring boot
Introduction to spring boot
 
Spring mvc
Spring mvcSpring mvc
Spring mvc
 
Spring Framework - AOP
Spring Framework - AOPSpring Framework - AOP
Spring Framework - AOP
 
MVC ppt presentation
MVC ppt presentationMVC ppt presentation
MVC ppt presentation
 
Introduction to Spring Boot!
Introduction to Spring Boot!Introduction to Spring Boot!
Introduction to Spring Boot!
 
Spring Framework - MVC
Spring Framework - MVCSpring Framework - MVC
Spring Framework - MVC
 
Spring boot
Spring bootSpring boot
Spring boot
 
laravel.pptx
laravel.pptxlaravel.pptx
laravel.pptx
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring Framework
 
MVC architecture
MVC architectureMVC architecture
MVC architecture
 
Spring Framework
Spring FrameworkSpring Framework
Spring Framework
 
Model view controller (mvc)
Model view controller (mvc)Model view controller (mvc)
Model view controller (mvc)
 
Web services SOAP
Web services SOAPWeb services SOAP
Web services SOAP
 
Hibernate Presentation
Hibernate  PresentationHibernate  Presentation
Hibernate Presentation
 

Similar a Spring MVC Framework

Mvc interview questions – deep dive jinal desai
Mvc interview questions – deep dive   jinal desaiMvc interview questions – deep dive   jinal desai
Mvc interview questions – deep dive jinal desaijinaldesailive
 
Design & Development of Web Applications using SpringMVC
Design & Development of Web Applications using SpringMVC Design & Development of Web Applications using SpringMVC
Design & Development of Web Applications using SpringMVC Naresh Chintalcheru
 
Java Spring MVC Framework with AngularJS by Google and HTML5
Java Spring MVC Framework with AngularJS by Google and HTML5Java Spring MVC Framework with AngularJS by Google and HTML5
Java Spring MVC Framework with AngularJS by Google and HTML5Tuna Tore
 
springmvc-150923124312-lva1-app6892
springmvc-150923124312-lva1-app6892springmvc-150923124312-lva1-app6892
springmvc-150923124312-lva1-app6892Tuna Tore
 
quickguide-einnovator-7-spring-mvc
quickguide-einnovator-7-spring-mvcquickguide-einnovator-7-spring-mvc
quickguide-einnovator-7-spring-mvcjorgesimao71
 
Lecture 05 - Creating a website with Razor Pages.pdf
Lecture 05 - Creating a website with Razor Pages.pdfLecture 05 - Creating a website with Razor Pages.pdf
Lecture 05 - Creating a website with Razor Pages.pdfLê Thưởng
 
Unit 38 - Spring MVC Introduction.pptx
Unit 38 - Spring MVC Introduction.pptxUnit 38 - Spring MVC Introduction.pptx
Unit 38 - Spring MVC Introduction.pptxAbhijayKulshrestha1
 
Spring mvc
Spring mvcSpring mvc
Spring mvcHui Xie
 
Introduction to Struts 1.3
Introduction to Struts 1.3Introduction to Struts 1.3
Introduction to Struts 1.3Ilio Catallo
 

Similar a Spring MVC Framework (20)

Mvc interview questions – deep dive jinal desai
Mvc interview questions – deep dive   jinal desaiMvc interview questions – deep dive   jinal desai
Mvc interview questions – deep dive jinal desai
 
Design & Development of Web Applications using SpringMVC
Design & Development of Web Applications using SpringMVC Design & Development of Web Applications using SpringMVC
Design & Development of Web Applications using SpringMVC
 
Spring mvc
Spring mvcSpring mvc
Spring mvc
 
Mvc
MvcMvc
Mvc
 
Asp.net,mvc
Asp.net,mvcAsp.net,mvc
Asp.net,mvc
 
Jinal desai .net
Jinal desai .netJinal desai .net
Jinal desai .net
 
Asp 1a-aspnetmvc
Asp 1a-aspnetmvcAsp 1a-aspnetmvc
Asp 1a-aspnetmvc
 
Aspnetmvc 1
Aspnetmvc 1Aspnetmvc 1
Aspnetmvc 1
 
Java Spring MVC Framework with AngularJS by Google and HTML5
Java Spring MVC Framework with AngularJS by Google and HTML5Java Spring MVC Framework with AngularJS by Google and HTML5
Java Spring MVC Framework with AngularJS by Google and HTML5
 
springmvc-150923124312-lva1-app6892
springmvc-150923124312-lva1-app6892springmvc-150923124312-lva1-app6892
springmvc-150923124312-lva1-app6892
 
MVC Framework
MVC FrameworkMVC Framework
MVC Framework
 
Mvc architecture
Mvc architectureMvc architecture
Mvc architecture
 
quickguide-einnovator-7-spring-mvc
quickguide-einnovator-7-spring-mvcquickguide-einnovator-7-spring-mvc
quickguide-einnovator-7-spring-mvc
 
Spring MVC 3.0 Framework
Spring MVC 3.0 FrameworkSpring MVC 3.0 Framework
Spring MVC 3.0 Framework
 
Lecture 05 - Creating a website with Razor Pages.pdf
Lecture 05 - Creating a website with Razor Pages.pdfLecture 05 - Creating a website with Razor Pages.pdf
Lecture 05 - Creating a website with Razor Pages.pdf
 
Unit 38 - Spring MVC Introduction.pptx
Unit 38 - Spring MVC Introduction.pptxUnit 38 - Spring MVC Introduction.pptx
Unit 38 - Spring MVC Introduction.pptx
 
Spring mvc
Spring mvcSpring mvc
Spring mvc
 
Dispatcher
DispatcherDispatcher
Dispatcher
 
React JS .NET
React JS .NETReact JS .NET
React JS .NET
 
Introduction to Struts 1.3
Introduction to Struts 1.3Introduction to Struts 1.3
Introduction to Struts 1.3
 

Último

Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationkaushalgiri8080
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
Introduction to Decentralized Applications (dApps)
Introduction to Decentralized Applications (dApps)Introduction to Decentralized Applications (dApps)
Introduction to Decentralized Applications (dApps)Intelisync
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 

Último (20)

Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanation
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Introduction to Decentralized Applications (dApps)
Introduction to Decentralized Applications (dApps)Introduction to Decentralized Applications (dApps)
Introduction to Decentralized Applications (dApps)
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 

Spring MVC Framework

  • 2. Content 1. HTTP Servlet (Review) 2. What is Spring MVC? 3. MVC Architecture 4. Request Processing Workflow in Spring MVC 5. Spring Web Application Context 6. Spring MVC Configuration 7. Important Annotations 8. Summary
  • 4. HTTP Servlets ● Are Java classes that run on Web Servers to dynamically process HTTP requests and construct HTTP responses. ● Deployed inside a Servlet Container which run on a Web Server. ● Tomcat is a popular Servlet Container.
  • 5. Servlets Architecture ● Servlets act as a middle layer between a Web browser and databases or applications on the Web Server. ● The following diagram shows the position of Servlets in a Web Application
  • 7. What is Spring MVC? Modules of Spring Framework on the Web layer: ● Web module provides basic web-oriented integration features and the initialization of the IoC container using servlet listeners and a web application context. ● Servlet module contains Spring MVC implementation for web applications.
  • 8. What is Spring MVC ? (cont.) ● A web framework built on the Servlet API. ● Provides Model-View-Controller (MVC) architecture and ready components that can be used to develop flexible and loosely coupled web applications. ● Request-driven, designed around a central Servlet that dispatches requests to controllers - the DispatcherServlet.
  • 9. MVC
  • 10. MVC (Model-View-Controller) Introduced by Trygve Reenskaug at Xerox Parc in 1979.
  • 11. MVC (Model-View-Controller) ● An architectural pattern commonly used for developing user interfaces. ● An application is divided into 3 interconnected parts: ○ Model - Responsible for managing data of the application. ○ View - Responsible for displaying the model data to user. ○ Controller - Responsible for processing user requests and building an appropriate model and passes it to the view for rendering.
  • 13. Request Processing Workflow (High Level) The request processing workflow in Spring Web MVC (high level)
  • 14. DispatcherServlet ● Spring MVC is designed around a central servlet named DispatcherServlet. ● DispatcherServlet acts as a central entry point to the Spring MVC application. ● Every request is handled by DispatcherServlet. ● DispatcherServlet is an expression of the Front Controller pattern. The request processing workflow in Spring Web MVC (high level)
  • 15. Controllers ● The Front Controller’s job is to determine a suitable handler capable of performing the actual processing. ● Handlers are Spring MVC Controllers. ● The selected Controller interacts with the service layer; the relevant data are collected in a model. ● When the Controller has finished processing, the Front Controller determines which view to render. The request processing workflow in Spring Web MVC (high level)
  • 16. View ● When the Controller has finished processing, the Front Controller determines which view to render. ● The Front Controller passes the model to the view which is finally which is finally rendered on the browser. The request processing workflow in Spring Web MVC (high level)
  • 17. Request Processing Workflow (Details Level) 1. DispatcherServlet receives the request. 2. DispatcherServlet dispatches the task of selecting an appropriate controller to HandlerMapping. HandlerMapping selects the Controller which is mapped to the incoming request URL and returns the (selected Handler) and Controller to DispatcherServlet. 3. DispatcherServlet dispatches the task of executing of business logic of Controller to HandlerAdapter. 4. HandlerAdapter calls the business logic process of Controller. 5. Controller executes the business logic, sets the processing result in Model and returns the logical name of view to HandlerAdapter. 6. DispatcherServlet dispatches the task of resolving the View corresponding to the View name to ViewResolver. ViewResolver returns the View mapped to View name. 7. DispatcherServlet dispatches the rendering process to returned View. 8. View renders Model data and returns the response.
  • 19. Web Application Context ● DispatcherServlet expects a WebApplicationContext, an extension of a plain ApplicationContext, for its own configuration. ● WebApplicationContext has a link to the ServletContext and Servlet it is associated with. ● The root WebApplicationContext typically contains infrastructure beans such as data repositories and business services which are inherited and could be overridden in the Servlet WebApplicationContext. ● Servlet WebApplicationContext contains web-related beans: such as controllers, handler mappings,...
  • 21. Spring MVC Configurations Spring MVC supports 2 type of configurations: ● XML Configuration ● Java-based Configuration
  • 23. Important annotations Some important annotations which are used in a Spring MVC application. ● @Controller and @RestController ● @RequestMapping ○ @GetMapping, @PostMapping, @PutMapping and @DeleteMapping ● @RequestParam, @PathVariable ● @RequestBody ● @ResponseBody