20220615 Servlet 相关的 Spring Boot 自动配置类
自动配置类
Servlet 相关的匹配的自动配置类:
org.springframework.boot.autoconfigure.web.servlet.DispatcherServletAutoConfiguration
org.springframework.boot.autoconfigure.web.embedded.EmbeddedWebServerFactoryCustomizerAutoConfiguration
org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration
org.springframework.boot.autoconfigure.web.servlet.HttpEncodingAutoConfiguration
org.springframework.boot.autoconfigure.http.HttpMessageConvertersAutoConfiguration
org.springframework.boot.autoconfigure.web.servlet.MultipartAutoConfiguration
org.springframework.boot.autoconfigure.web.client.RestTemplateAutoConfiguration
org.springframework.boot.autoconfigure.web.servlet.ServletWebServerFactoryAutoConfiguration
org.springframework.boot.autoconfigure.task.TaskExecutionAutoConfiguration
org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration
无关的匹配的自动配置类
org.springframework.boot.autoconfigure.aop.AopAutoConfiguration
org.springframework.boot.autoconfigure.jmx.JmxAutoConfiguration
org.springframework.boot.autoconfigure.context.LifecycleAutoConfiguration
org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration
org.springframework.boot.autoconfigure.admin.SpringApplicationAdminJmxAutoConfiguration
org.springframework.boot.autoconfigure.sql.init.SqlInitializationAutoConfiguration
org.springframework.boot.autoconfigure.websocket.servlet.WebSocketServletAutoConfiguration
相关的属性类
org.springframework.boot.autoconfigure.web.servlet.WebMvcProperties
spring.mvc
org.springframework.boot.autoconfigure.web.WebProperties
spring.web
org.springframework.boot.autoconfigure.web.ServerProperties
server
org.springframework.boot.autoconfigure.web.servlet.MultipartProperties
spring.servlet.multipart
org.springframework.boot.autoconfigure.task.TaskExecutionProperties
spring.task.execution
自动配置类中的 @Bean
DispatcherServletAutoConfiguration
DispatcherServletAutoConfiguration.DispatcherServletConfiguration
静态内部类
引入(@Import
) @Bean
:
DispatcherServlet dispatcherServlet
DispatcherServletAutoConfiguration.DispatcherServletRegistrationConfiguration
静态内部类
匹配(@Condition
) @Bean
:
DispatcherServletRegistrationBean dispatcherServletRegistration
EmbeddedWebServerFactoryCustomizerAutoConfiguration
EmbeddedWebServerFactoryCustomizerAutoConfiguration.TomcatWebServerFactoryCustomizerConfiguration
静态内部类
匹配(@Condition
) @Bean
:
TomcatWebServerFactoryCustomizer tomcatWebServerFactoryCustomizer
ErrorMvcAutoConfiguration
引入(@Import
) @Bean
:
ErrorPageCustomizer errorPageCustomizer
静态引入(@Import
) @Bean
:
PreserveErrorControllerTargetClassPostProcessor preserveErrorControllerTargetClassPostProcessor
匹配(@Condition
) @Bean
:
DefaultErrorAttributes errorAttributes
BasicErrorController basicErrorController
ErrorMvcAutoConfiguration.DefaultErrorViewResolverConfiguration
静态内部类
匹配(@Condition
) @Bean
:
DefaultErrorViewResolver conventionErrorViewResolver
ErrorMvcAutoConfiguration.WhitelabelErrorViewConfiguration
静态内部类
匹配(@Condition
) @Bean
:
@Bean(name = "error") View defaultErrorView
BeanNameViewResolver beanNameViewResolver
HttpEncodingAutoConfiguration
引入(@Import
) @Bean
:
LocaleCharsetMappingsCustomizer localeCharsetMappingsCustomizer
匹配(@Condition
) @Bean
:
CharacterEncodingFilter characterEncodingFilter
HttpMessageConvertersAutoConfiguration
匹配(@Condition
) @Bean
:
HttpMessageConverters messageConverters
HttpMessageConvertersAutoConfiguration.StringHttpMessageConverterConfiguration
匹配(@Condition
) @Bean
:
StringHttpMessageConverter stringHttpMessageConverter
JacksonHttpMessageConvertersConfiguration
引入的配置类
JacksonHttpMessageConvertersConfiguration.MappingJackson2HttpMessageConverterConfiguration
静态内部类
匹配(@Condition
) @Bean
:
MappingJackson2HttpMessageConverter mappingJackson2HttpMessageConverter
MultipartAutoConfiguration
匹配(@Condition
) @Bean
:
MultipartConfigElement multipartConfigElement
StandardServletMultipartResolver multipartResolver
RestTemplateAutoConfiguration
匹配(@Condition
)@Lazy
@Bean
:
RestTemplateBuilderConfigurer restTemplateBuilderConfigurer
RestTemplateBuilder restTemplateBuilder
ServletWebServerFactoryAutoConfiguration
引入(@Import
) @Bean
:
ServletWebServerFactoryCustomizer servletWebServerFactoryCustomizer
匹配(@Condition
) @Bean
:
TomcatServletWebServerFactoryCustomizer tomcatServletWebServerFactoryCustomizer
ServletWebServerFactoryAutoConfiguration.BeanPostProcessorsRegistrar
引入的 ImportBeanDefinitionRegistrar
webServerFactoryCustomizerBeanPostProcessor
WebServerFactoryCustomizerBeanPostProcessor
errorPageRegistrarBeanPostProcessor
ErrorPageRegistrarBeanPostProcessor
ServletWebServerFactoryConfiguration.EmbeddedTomcat
引入的配置类
TomcatServletWebServerFactory tomcatServletWebServerFactory
TaskExecutionAutoConfiguration
匹配(@Condition
) @Bean
:
TaskExecutorBuilder taskExecutorBuilder
ThreadPoolTaskExecutor applicationTaskExecutor
WebMvcAutoConfiguration
匹配(@Condition
) @Bean
:
OrderedFormContentFilter formContentFilter
WebMvcAutoConfiguration.EnableWebMvcConfiguration
静态内部类
继承 WebMvcConfigurationSupport
:这是提供 MVC Java 配置背后的配置的主类。它通常通过将 @EnableWebMvc
添加到应用程序 @Configuration
类来导入。另一种更高级的选择是直接从此类扩展并根据需要覆盖方法,记住将 @Configuration
添加到子类,将 @Bean
添加到覆盖的 @Bean
方法。
引入(@Import
) @Bean
:
WelcomePageHandlerMapping welcomePageHandlerMapping
引入父类 WebMvcConfigurationSupport
@Bean
方法
PathPatternParser mvcPatternParser
UrlPathHelper mvcUrlPathHelper
PathMatcher mvcPathMatcher
HandlerMapping viewControllerHandlerMapping
BeanNameUrlHandlerMapping beanNameHandlerMapping
RouterFunctionMapping routerFunctionMapping
HandlerMapping resourceHandlerMapping
ResourceUrlProvider mvcResourceUrlProvider
HandlerMapping defaultServletHandlerMapping
HandlerFunctionAdapter handlerFunctionAdapter
CompositeUriComponentsContributor mvcUriComponentsContributor
HttpRequestHandlerAdapter httpRequestHandlerAdapter
SimpleControllerHandlerAdapter simpleControllerHandlerAdapter
HandlerExceptionResolver handlerExceptionResolver
ViewResolver mvcViewResolver
HandlerMappingIntrospector mvcHandlerMappingIntrospector
RequestToViewNameTranslator viewNameTranslator
重写父类 WebMvcConfigurationSupport
@Bean
方法
RequestMappingHandlerAdapter requestMappingHandlerAdapter
RequestMappingHandlerMapping requestMappingHandlerMapping
FormattingConversionService mvcConversionService
Validator mvcValidator
ContentNegotiationManager mvcContentNegotiationManager
LocaleResolver localeResolver
ThemeResolver themeResolver
FlashMapManager flashMapManager
WebMvcAutoConfiguration.WebMvcAutoConfigurationAdapter
静态内部类
匹配(@Condition
) @Bean
:
InternalResourceViewResolver defaultViewResolver
RequestContextFilter requestContextFilter
ContentNegotiatingViewResolver viewResolver
部分不匹配的配置类和 @Bean
下面存在不匹配方法的都是匹配的配置类,不存在不匹配方法的配置类都不匹配
ServletWebServerFactoryAutoConfiguration.ForwardedHeaderFilterConfiguration
DispatcherServletAutoConfiguration.DispatcherServletConfiguration
MultipartResolver multipartResolver
ServletWebServerFactoryConfiguration.EmbeddedJetty
ServletWebServerFactoryConfiguration.EmbeddedUndertow
TaskSchedulingAutoConfiguration
ThreadPoolTaskScheduler taskScheduler
ValidationAutoConfiguration
WebMvcAutoConfiguration
OrderedHiddenHttpMethodFilter hiddenHttpMethodFilter
WebMvcAutoConfiguration.WebMvcAutoConfigurationAdapter
BeanNameViewResolver beanNameViewResolver