WebMvcAutoconfiguration内部静态类WebMvcAutoConfigurationAdapter实现了WebMvcConfigurer接口,重写了一些方法,也就是默认对Spring Mvc进行了一些配置:
该静态类上有个**@Import**注解:
@Import(EnableWebMvcConfiguration.class)文章来源:https://www.toymoban.com/news/detail-646599.html
它的父类DelegatingWebMvcConfiguration,
通过注入的方式,把容器中所有实现了WebMvcConfigurer的bean注入到configurers中,而this.configurers.addWebMvcConfigurers(configures)执行逻辑如下:
也就是把List传给WebMvcConfigurer的成员变量delegates.
当底层调用WebMvcConfigurerComposite的方法时,会遍历delegates进行调用:
文章来源地址https://www.toymoban.com/news/detail-646599.html
到了这里,关于SpringBoot复习:(33)WebMvcAutoconfiguration内部静态类WebMvcAutoConfigurationAdapter的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!