mirror of
https://github.com/spring-projects/spring-boot.git
synced 2026-05-03 03:43:54 +01:00
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
This commit is contained in:
@@ -783,8 +783,7 @@ available at http://spring.io/guides that cover Spring MVC.
|
|||||||
[[boot-features-spring-mvc-auto-configuration]]
|
[[boot-features-spring-mvc-auto-configuration]]
|
||||||
==== Spring MVC auto-configuration
|
==== Spring MVC auto-configuration
|
||||||
Spring Boot provides auto-configuration for Spring MVC that works well with most
|
Spring Boot provides auto-configuration for Spring MVC that works well with most
|
||||||
applications. If you want to take complete control of Spring MVC you can add your
|
applications.
|
||||||
own `@Configuration` annotated with `@EnableWebMvc`.
|
|
||||||
|
|
||||||
The auto-configuration adds the following features on top of Spring's defaults:
|
The auto-configuration adds the following features on top of Spring's defaults:
|
||||||
|
|
||||||
@@ -795,7 +794,13 @@ The auto-configuration adds the following features on top of Spring's defaults:
|
|||||||
* Static `index.html` support.
|
* Static `index.html` support.
|
||||||
* Custom `Favicon` support.
|
* Custom `Favicon` support.
|
||||||
|
|
||||||
|
If you want to take complete control of Spring MVC you can add your
|
||||||
|
own `@Configuration` annotated with `@EnableWebMvc`. If you want the
|
||||||
|
Boot features, and just want to add additional [normal MVC
|
||||||
|
configuration](http://docs.spring.io/spring/docs/current/spring-framework-reference/html/mvc.html),
|
||||||
|
like interceptors, formatters, view controllers etc, you can simply
|
||||||
|
add your own `@Bean` of type `WebMvcConfigurerAdapter` (like normal
|
||||||
|
MVC), but don't forget *not* to add `@EnableWebMvc`.
|
||||||
|
|
||||||
[[boot-features-spring-mvc-message-converters]]
|
[[boot-features-spring-mvc-message-converters]]
|
||||||
==== HttpMessageConverters
|
==== HttpMessageConverters
|
||||||
|
|||||||
Reference in New Issue
Block a user