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:

@Configuration
@EnableWebMvc
public class WebConfiguration {
}
When using Infra App, you may want to use @Configuration classes of type WebMvcConfigurer but without @EnableWebMvc to keep Infra App MVC customizations. See more details in the MVC Config API section and in the dedicated Infra App documentation.

The preceding example registers a number of Web MVC infrastructure beans and adapts to dependencies available on the classpath (for example, payload converters for JSON, XML, and others).