Skip to content

Commit

Permalink
Polish contribution
Browse files Browse the repository at this point in the history
  • Loading branch information
snicoll committed Aug 9, 2022
1 parent c441baf commit 12c1da2
Showing 1 changed file with 3 additions and 10 deletions.
Expand Up @@ -127,17 +127,10 @@ If you set the configprop:spring.mvc.message-codes-resolver-format[] property `P
By default, Spring Boot serves static content from a directory called `/static` (or `/public` or `/resources` or `/META-INF/resources`) in the classpath or from the root of the `ServletContext`.
It uses the `ResourceHttpRequestHandler` from Spring MVC so that you can modify that behavior by adding your own `WebMvcConfigurer` and overriding the `addResourceHandlers` method.

In a stand-alone web application, default servlet is not enabled. It can be enabled as follows:
In a stand-alone web application, the default servlet from the container is not enabled.
It can be enabled using the configprop:server.servlet.register-default-servlet[] property.


[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
----
server:
servlet:
register-default-servlet: true
----

If the default servlet is enablend it acts as a fallback, serving content from the root of the `ServletContext` if Spring decides not to handle it.
The default servlet acts as a fallback, serving content from the root of the `ServletContext` if Spring decides not to handle it.
Most of the time, this does not happen (unless you modify the default MVC configuration), because Spring can always handle requests through the `DispatcherServlet`.

By default, resources are mapped on `+/**+`, but you can tune that with the configprop:spring.mvc.static-path-pattern[] property.
Expand Down

0 comments on commit 12c1da2

Please sign in to comment.