Skip to content

Commit b978950

Browse files
committed
Clarify the effect of @EnableWebMvc
Closes gh-36506
1 parent 8dec443 commit b978950

File tree

1 file changed

+4
-3
lines changed
  • spring-boot-project/spring-boot-docs/src/docs/asciidoc/web

1 file changed

+4
-3
lines changed

spring-boot-project/spring-boot-docs/src/docs/asciidoc/web/servlet.adoc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ Beans can be ordered if you need to apply a precedence.
3131
[[web.servlet.spring-mvc.auto-configuration]]
3232
==== Spring MVC Auto-configuration
3333
Spring Boot provides auto-configuration for Spring MVC that works well with most applications.
34-
35-
The auto-configuration adds the following features on top of Spring's defaults:
34+
It replaces the need for `@EnableWebMvc` and the two cannot be used together.
35+
In addition to Spring MVC's defaults, the auto-configuration provides the following features:
3636

3737
* Inclusion of `ContentNegotiatingViewResolver` and `BeanNameViewResolver` beans.
3838
* Support for serving static resources, including support for WebJars (covered <<features#web.servlet.spring-mvc.static-content,later in this document>>).
@@ -46,7 +46,8 @@ If you want to keep those Spring Boot MVC customizations and make more {spring-f
4646

4747
If you want to provide custom instances of `RequestMappingHandlerMapping`, `RequestMappingHandlerAdapter`, or `ExceptionHandlerExceptionResolver`, and still keep the Spring Boot MVC customizations, you can declare a bean of type `WebMvcRegistrations` and use it to provide custom instances of those components.
4848

49-
If you want to take complete control of Spring MVC, you can add your own `@Configuration` annotated with `@EnableWebMvc`, or alternatively add your own `@Configuration`-annotated `DelegatingWebMvcConfiguration` as described in the Javadoc of `@EnableWebMvc`.
49+
If you do not want to use the auto-configuration and want to take complete control of Spring MVC, add your own `@Configuration` annotated with `@EnableWebMvc`.
50+
Alternatively, add your own `@Configuration`-annotated `DelegatingWebMvcConfiguration` as described in the Javadoc of `@EnableWebMvc`.
5051

5152

5253

0 commit comments

Comments
 (0)