@@ -28200,6 +28200,37 @@ With the above Servlet configuration in place, you will need to have a file call
28200
28200
Spring Web MVC-specific components (beans). You can change the exact location of this
28201
28201
configuration file through a Servlet initialization parameter (see below for details).
28202
28202
28203
+ It is also possible to have just one root context for single DispatcherServlet scenarios
28204
+ by setting an empty contextConfigLocation servlet init parameter, as shown below:
28205
+
28206
+ [source,xml,indent=0]
28207
+ [subs="verbatim,quotes"]
28208
+ ----
28209
+ <web-app>
28210
+ <context-param>
28211
+ <param-name>contextConfigLocation</param-name>
28212
+ <param-value>/WEB-INF/root-context.xml</param-value>
28213
+ </context-param>
28214
+ <servlet>
28215
+ <servlet-name>dispatcher</servlet-name>
28216
+ <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
28217
+ <init-param>
28218
+ <param-name>contextConfigLocation</param-name>
28219
+ <param-value></param-value>
28220
+ </init-param>
28221
+ <load-on-startup>1</load-on-startup>
28222
+ </servlet>
28223
+ <servlet-mapping>
28224
+ <servlet-name>dispatcher</servlet-name>
28225
+ <url-pattern>/*</url-pattern>
28226
+ </servlet-mapping>
28227
+ <listener>
28228
+ <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
28229
+ </listener>
28230
+ </web-app>
28231
+ ----
28232
+
28233
+
28203
28234
The `WebApplicationContext` is an extension of the plain `ApplicationContext` that has
28204
28235
some extra features necessary for web applications. It differs from a normal
28205
28236
`ApplicationContext` in that it is capable of resolving themes (see
@@ -31888,7 +31919,9 @@ To enable MVC Java config add the annotation `@EnableWebMvc` to one of your
31888
31919
}
31889
31920
----
31890
31921
31891
- To achieve the same in XML use the `mvc:annotation-driven` element:
31922
+ To achieve the same in XML use the `mvc:annotation-driven` element in your
31923
+ DispatcherServlet context (or in your root context if you have no DispatcherServlet
31924
+ context defined):
31892
31925
31893
31926
[source,xml,indent=0]
31894
31927
[subs="verbatim,quotes"]
0 commit comments