Document Welcome Page support ordering

This commit documents the relative ordering of `HandlerMapping` support
in Spring MVC and WebFlux applications.
As of Spring Framework 6.1.0, the Welcome Page support acts as a
fallback in case no index route has been defined by the application as a
`RouterFunction` or within an annotated `@Controller`.

Closes gh-34846
pull/37340/head
Brian Clozel 1 year ago
parent c951c4c212
commit 0d902c1323

@ -120,6 +120,21 @@ It first looks for an `index.html` file in the configured static content locatio
If one is not found, it then looks for an `index` template.
If either is found, it is automatically used as the welcome page of the application.
This only acts as a fallback for actual index routes defined by the application.
The ordering is defined by the order of `HandlerMapping` beans which is by default the following:
[cols="1,1"]
|===
|`RouterFunctionMapping`
|Endpoints declared with `RouterFunction` beans
|`RequestMappingHandlerMapping`
|Endpoints declared in `@Controller` beans
|`RouterFunctionMapping` for the Welcome Page
|The welcome page support
|===
[[web.reactive.webflux.template-engines]]

@ -196,6 +196,20 @@ It first looks for an `index.html` file in the configured static content locatio
If one is not found, it then looks for an `index` template.
If either is found, it is automatically used as the welcome page of the application.
This only acts as a fallback for actual index routes defined by the application.
The ordering is defined by the order of `HandlerMapping` beans which is by default the following:
[cols="1,1"]
|===
|`RouterFunctionMapping`
|Endpoints declared with `RouterFunction` beans
|`RequestMappingHandlerMapping`
|Endpoints declared in `@Controller` beans
|`WelcomePageHandlerMapping`
|The welcome page support
|===
[[web.servlet.spring-mvc.favicon]]

Loading…
Cancel
Save