Skip to content

Commit df9290c

Browse files
committed
Improve DispatcherServlet diagrams
Issue: SPR-13120
1 parent c1b5262 commit df9290c

File tree

6 files changed

+950
-6
lines changed

6 files changed

+950
-6
lines changed
63 KB
Loading

src/asciidoc/images/mvc-context-hierarchy.svg

Lines changed: 612 additions & 0 deletions
Loading

src/asciidoc/images/mvc-contexts.gif

-39.9 KB
Binary file not shown.
54 KB
Loading
Lines changed: 328 additions & 0 deletions
Loading

src/asciidoc/web-mvc.adoc

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,9 @@ in the following diagram. The pattern-savvy reader will recognize that the
156156
`DispatcherServlet` is an expression of the "Front Controller" design pattern (this is a
157157
pattern that Spring Web MVC shares with many other leading web frameworks).
158158

159+
.The request processing workflow in Spring Web MVC (high level)
159160
image::images/mvc.png[width=400]
160161

161-
The request processing workflow in Spring Web MVC (high level)
162-
163162
The `DispatcherServlet` is an actual `Servlet` (it inherits from the `HttpServlet` base
164163
class), and as such is declared in the `web.xml` of your web application. You need to
165164
map requests that you want the `DispatcherServlet` to handle, by using a URL mapping in
@@ -221,8 +220,8 @@ scoped. In the Web MVC framework, each `DispatcherServlet` has its own
221220
`WebApplicationContext`. These inherited beans can be overridden in the servlet-specific
222221
scope, and you can define new scope-specific beans local to a given Servlet instance.
223222

224-
.Context hierarchy in Spring Web MVC
225-
image::images/mvc-contexts.gif[width=400]
223+
.Typical context hierarchy in Spring Web MVC
224+
image::images/mvc-context-hierarchy.png[width=400]
226225

227226
Upon initialization of a `DispatcherServlet`, Spring MVC looks for a file named
228227
__[servlet-name]-servlet.xml__ in the `WEB-INF` directory of your web application and
@@ -252,8 +251,13 @@ With the above Servlet configuration in place, you will need to have a file call
252251
Spring Web MVC-specific components (beans). You can change the exact location of this
253252
configuration file through a Servlet initialization parameter (see below for details).
254253

255-
It is also possible to have just one root context for single DispatcherServlet scenarios
256-
by setting an empty contextConfigLocation servlet init parameter, as shown below:
254+
It is also possible to have just one root context for single DispatcherServlet scenarios.
255+
256+
.Single root context in Spring Web MVC
257+
image::images/mvc-root-context.png[width=400]
258+
259+
This can be configured by setting an empty contextConfigLocation servlet init parameter,
260+
as shown below:
257261

258262
[source,xml,indent=0]
259263
[subs="verbatim,quotes"]

0 commit comments

Comments
 (0)