Skip to content

Commit 01775ba

Browse files
author
Dave Syer
committed
Clarify role of MVC autoconfiguration
Users only have to add a normal `WebMvcConfigurer` to configure their own features. Sometimes that's not clear enough (and it's good to stress that `@EnableWebMvc` is the thing that switches off the Boot configurtation. Fixes gh-583
1 parent 142a310 commit 01775ba

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -783,8 +783,7 @@ available at http://spring.io/guides that cover Spring MVC.
783783
[[boot-features-spring-mvc-auto-configuration]]
784784
==== Spring MVC auto-configuration
785785
Spring Boot provides auto-configuration for Spring MVC that works well with most
786-
applications. If you want to take complete control of Spring MVC you can add your
787-
own `@Configuration` annotated with `@EnableWebMvc`.
786+
applications.
788787

789788
The auto-configuration adds the following features on top of Spring's defaults:
790789

@@ -795,7 +794,13 @@ The auto-configuration adds the following features on top of Spring's defaults:
795794
* Static `index.html` support.
796795
* Custom `Favicon` support.
797796

798-
797+
If you want to take complete control of Spring MVC you can add your
798+
own `@Configuration` annotated with `@EnableWebMvc`. If you want the
799+
Boot features, and just want to add additional [normal MVC
800+
configuration](http://docs.spring.io/spring/docs/current/spring-framework-reference/html/mvc.html),
801+
like interceptors, formatters, view controllers etc, you can simply
802+
add your own `@Bean` of type `WebMvcConfigurerAdapter` (like normal
803+
MVC), but don't forget *not* to add `@EnableWebMvc`.
799804

800805
[[boot-features-spring-mvc-message-converters]]
801806
==== HttpMessageConverters

0 commit comments

Comments
 (0)