Spring Boot 中的 @EnableWebMvc
@EnableWebMvc
注解并不是像一般理解的那样在 Spring Boot 中使用 Spring MVC 必需要有的配置,而且并不是像字面意思那样启用 Spring MVC 的
功能。
@EnableWebMvc
的作用是引入 DelegatingWebMvcConfiguration
类来支持通过 WebMvcConfigurer
来对 WebMvc 进行配置。但其引入 DelegatingWebMvcConfiguration
的结果是导致 Spring MVC 相关的自动配置功能失效。