[[mvc-config-enable]]
= Enable MVC Configuration

[.small]#xref:web/webflux/config.adoc#webflux-config-enable[See equivalent in the Reactive stack]#

You can use the `@EnableWebMvc` annotation to enable MVC configuration with programmatic configuration, or `<mvc:annotation-driven>` with XML configuration, as the following example shows:

include-code::./WebConfiguration[tag=snippet,indent=0]

NOTE: When using Spring Boot, you may want to use `@Configuration` classes of type `WebMvcConfigurer` but without `@EnableWebMvc` to keep Spring Boot MVC customizations. See more details in xref:web/webmvc/mvc-config/customize.adoc[the MVC Config API section] and in {spring-boot-docs}/web.html#web.servlet.spring-mvc.auto-configuration[the dedicated Spring Boot documentation].

The preceding example registers a number of Spring MVC
xref:web/webmvc/mvc-servlet/special-bean-types.adoc[infrastructure beans] and adapts to dependencies
available on the classpath (for example, payload converters for JSON, XML, and others).



