Enable MVC Configuration
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:
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 the MVC Config API section and in the dedicated Spring Boot documentation.
|
The preceding example registers a number of Spring MVC infrastructure beans and adapts to dependencies available on the classpath (for example, payload converters for JSON, XML, and others).