> For the complete documentation index, see [llms.txt](https://jack80342.gitbook.io/spring-boot/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jack80342.gitbook.io/spring-boot/iv.-spring-boot-features/27.-developing-web-applications/27.1.-the-spring-web-mvc-framework/27.1.1.-spring-mvc-auto-configuration.md).

# 27.1.1. Spring MVC自动配置

Spring Boot为Spring MVC提供的auto-configuration适用于大多数应用，并在Spring默认功能上添加了以下特性：

1. 引入`ContentNegotiatingViewResolver`和`BeanNameViewResolver` beans。
2. 对静态资源的支持，包括对WebJars的支持。
3. 自动注册`Converter`，`GenericConverter`，`Formatter` beans。
4. 对`HttpMessageConverters`的支持。
5. 自动注册`MessageCodeResolver`。
6. 对静态`index.html`的支持。
7. 对自定义`Favicon`的支持。
8. 自动使用`ConfigurableWebBindingInitializer` bean。

如果保留Spring Boot MVC特性，你只需添加其他的[MVC配置](https://docs.spring.io/spring/docs/5.0.4.RELEASE/spring-framework-reference/web.html#mvc)（拦截器，格式化处理器，视图控制器等）。你可以添加自己的`WebMvcConfigurer`类型的`@Configuration`类，而不需要注解`@EnableWebMvc`。如果希望使用自定义的`RequestMappingHandlerMapping`，`RequestMappingHandlerAdapter`，或`ExceptionHandlerExceptionResolver`，你可以声明一个`WebMvcRegistrationsAdapter`实例提供这些组件。

如果想全面控制Spring MVC，你可以添加自己的`@Configuration`，并使用`@EnableWebMvc`注解。
