2023.02.20 SpringBoot源码解析
2023-02-17 21:22:04 14 举报
SpringBoot源码解析
作者其他创作
大纲/内容
【propertySourceList】0 = {PropertySource$StubPropertySource@2144} \"StubPropertySource {name='servletConfigInitParams'}\"1 = {PropertySource$StubPropertySource@2145} \"StubPropertySource {name='servletContextInitParams'}\"2 = {PropertiesPropertySource@2146} \"PropertiesPropertySource {name='systemProperties'}\"3 = {SystemEnvironmentPropertySource@2147} \"SystemEnvironmentPropertySource {name='systemEnvironment'}\"
boot.context.event.EventPublishingRunListener
listeners.starting
Trigger initialization of all non-lazy singleton beans
xmlReader
jar:file:/C:/repository/org/springframework/cloud/spring-cloud-context/3.1.3/spring-cloud-context-3.1.3.jar!/META-INF/spring.factories
XmlBeanDefinitionReader
internalPostProcessors
jar:file:/C:/repository/org/springframework/spring-beans/5.3.22/spring-beans-5.3.22.jar!/META-INF/spring.factories
listeners.started
invoke the BeanDefinitionRegistryPostProcessors that implement PriorityOrdered
0 = {ConfigurationPropertySourcesPropertySource@2648} \"ConfigurationPropertySourcesPropertySource {name='configurationProperties'}\"1 = {SimpleCommandLinePropertySource@2649} \"SimpleCommandLinePropertySource {name='commandLineArgs'}\"2 = {PropertySource$StubPropertySource@2650} \"StubPropertySource {name='servletConfigInitParams'}\"3 = {PropertySource$StubPropertySource@2651} \"StubPropertySource {name='servletContextInitParams'}\"4 = {PropertiesPropertySource@2652} \"PropertiesPropertySource {name='systemProperties'}\"5 = {SystemEnvironmentPropertySourceEnvironmentPostProcessor$OriginAwareSystemEnvironmentPropertySource@2874} \"OriginAwareSystemEnvironmentPropertySource {name='systemEnvironment'}\"6 = {RandomValuePropertySource@2806} \"RandomValuePropertySource {name='random'}\"7 = {CachedRandomPropertySource@2864} \"CachedRandomPropertySource {name='cachedrandom'}\"8 = {MapPropertySource@3062} \"MapPropertySource {name='springCloudClientHostInfo'}\"9 = {OriginTrackedMapPropertySource@3492} \"OriginTrackedMapPropertySource {name='Config resource 'class path resource [application.yml]' via location 'optional:classpath:/''}\"
ClassPathBeanDefinitionScanner
context.annotation.internalConfigurationAnnotationProcessor【ConfigurationClassPostProcessor】
ApplicationReadyEvent
load
【applicationContextFactory】org.springframework.core.io.support.SpringFactoriesLoader#loadSpringFactories
finishRefresh
beanFacotry.beanDefinitionNames
BeanDefinitionLoader
AnnotatedBeanDefinitionReader
0 = \"&org.springframework.boot.autoconfigure.internalCachingMetadataReaderFactory\"1 = \"cpConfig\"2 = \"mvcResourceUrlProvider\"3 = \"springApplicationAdminRegistrar\"4 = \"applicationAvailability\"5 = \"refreshScope\"6 = \"loggingRebinder\"7 = \"configDataContextRefresher\"8 = \"refreshEventListener\"9 = \"delegatingApplicationListener\"10 = \"configurationPropertiesRebinder\"11 = \"org.springframework.cloud.client.discovery.simple.SimpleDiscoveryClientAutoConfiguration\"12 = \"org.springframework.cloud.netflix.eureka.EurekaDiscoveryClientConfiguration$EurekaClientConfigurationRefresher\"13 = \"eurekaAutoServiceRegistration\"
2 = {PropertiesPropertySource@2420} \"PropertiesPropertySource {name='systemProperties'}\"3 = {SystemEnvironmentPropertySource@2421} \"SystemEnvironmentPropertySource {name='systemEnvironment'}\"
AbstractApplicationContext
0 = {SharedMetadataReaderFactoryContextInitializer$CachingMetadataReaderFactoryPostProcessor@3853} 1 = {ConfigurationWarningsApplicationContextInitializer$ConfigurationWarningsPostProcessor@3854} 2 = {SpringApplication$PropertySourceOrderingBeanFactoryPostProcessor@3829}
registerBeanPostProcessors
SpringApplicationRunListener
SimpleApplicationEventMulticaster
BootstrapRegistryInitializer
ApplicationContextAwareProcessor
容器中的bean
ConversionService
ApplicationContextInitializer
clearResourceCaches
initializer.initialize
ApplicationListenerDetector
0 = {RSocketPortInfoApplicationContextInitializer$Listener@6536} 1 = {ServerPortInfoApplicationContextInitializer@6537} 2 = {ConditionEvaluationReportLoggingListener$ConditionEvaluationReportListener@6538} 3 = {BootstrapApplicationListener@6539} 4 = {LoggingSystemShutdownListener@6540} 5 = {EnvironmentPostProcessorApplicationListener@6541} 6 = {AnsiOutputApplicationListener@6542} 7 = {LoggingApplicationListener@6543} 8 = {BackgroundPreinitializer@6544} 9 = {DelegatingApplicationListener@6545} 10 = {RestartListener@6546} 11 = {ParentContextCloserApplicationListener@6547} 12 = {ClearCachesApplicationListener@6548} 13 = {FileEncodingApplicationListener@6549} 14 = {SpringApplicationShutdownHook$ApplicationContextClosedListener@6550} 15 = {SharedMetadataReaderFactoryContextInitializer$SharedMetadataReaderFactoryBean@6551} 16 = {RefreshScope@6552}
【Environment】ApplicationServletEnvironment(ConfigurableEnvironment)
fresh
callRunners
WebApplicationContextServletContextAwareProcessor
jar:file:/C:/repository/org/springframework/cloud/spring-cloud-netflix-eureka-client/3.1.3/spring-cloud-netflix-eureka-client-3.1.3.jar!/META-INF/spring.factories
\"org.springframework.boot.diagnostics.FailureAnalyzer\" -> \"org.springframework.cloud.configuration.CompatibilityNotMetFailureAnalyzer\"\"org.springframework.boot.env.EnvironmentPostProcessor\" -> \"org.springframework.cloud.client.HostInfoEnvironmentPostProcessor\"\"org.springframework.boot.autoconfigure.EnableAutoConfiguration\" -> \
applyInitializers
0 = \"org.springframework.context.annotation.internalConfigurationAnnotationProcessor\"1 = \"org.springframework.context.annotation.internalAutowiredAnnotationProcessor\"2 = \"org.springframework.context.annotation.internalCommonAnnotationProcessor\"3 = \"org.springframework.context.event.internalEventListenerProcessor\"4 = \"org.springframework.context.event.internalEventListenerFactory\"5 = \"consumerApplication\"6 = \"org.springframework.boot.autoconfigure.internalCachingMetadataReaderFactory\"
StandardEnvironment
ignoreDependencyInterface
class org.springframework.boot.context.event.EventPublishingRunListener
invoke the BeanDefinitionRegistryPostProcessors that implement Ordered
createBootstrapContext
\"org.springframework.boot.BootstrapRegistryInitializer\" -> \"org.springframework.cloud.netflix.eureka.config.EurekaConfigServerBootstrapper\"\"org.springframework.cloud.bootstrap.BootstrapConfiguration\" -> \"org.springframework.cloud.netflix.eureka.config.EurekaConfigServerBootstrapConfiguration\"\"org.springframework.boot.autoconfigure.EnableAutoConfiguration\" -> \
URL [jar:file:/C:/repository/org/springframework/cloud/spring-cloud-openfeign-core/3.1.3/spring-cloud-openfeign-core-3.1.3.jar!/META-INF/spring.factories]
0 = \"org.springframework.cloud.bootstrap.RefreshBootstrapRegistryInitializer\"1 = \"org.springframework.cloud.bootstrap.TextEncryptorConfigBootstrapper\"2 = \"org.springframework.cloud.netflix.eureka.config.EurekaConfigServerBootstrapper\"
【ApplicationContext】AnnotationConfigServletWebServerApplicationContext(ConfigurableApplicationContext)
applicationEventMulticaster.defaultRetriever
prepareRefresh
ApplicationContextInitializedEvent
getOrCreateEnvironment
refreshContext
mappings.mappings.stream().map(AnnotationTypeMapping::getMetaTypes).collect(Collectors.toList()) = {ArrayList@4752} size = 11 0 = {Collections$SingletonList@4728} size = 1 0 = {Class@3479} \"interface org.springframework.boot.autoconfigure.SpringBootApplication\" 1 = {Collections$UnmodifiableRandomAccessList@4754} size = 2 0 = {Class@3479} \"interface org.springframework.boot.autoconfigure.SpringBootApplication\" 1 = {Class@3506} \"interface org.springframework.boot.SpringBootConfiguration\" 2 = {Collections$UnmodifiableRandomAccessList@4755} size = 2 0 = {Class@3479} \"interface org.springframework.boot.autoconfigure.SpringBootApplication\" 1 = {Class@3502} \"interface org.springframework.boot.autoconfigure.EnableAutoConfiguration\" 3 = {Collections$UnmodifiableRandomAccessList@4756} size = 2 0 = {Class@3479} \"interface org.springframework.boot.autoconfigure.SpringBootApplication\" 1 = {Class@3504} \"interface org.springframework.context.annotation.ComponentScan\" 4 = {Collections$UnmodifiableRandomAccessList@4757} size = 3 0 = {Class@3479} \"interface org.springframework.boot.autoconfigure.SpringBootApplication\" 1 = {Class@3506} \"interface org.springframework.boot.SpringBootConfiguration\" 2 = {Class@3505} \"interface org.springframework.context.annotation.Configuration\" 5 = {Collections$UnmodifiableRandomAccessList@4758} size = 3 0 = {Class@3479} \"interface org.springframework.boot.autoconfigure.SpringBootApplication\" 1 = {Class@3506} \"interface org.springframework.boot.SpringBootConfiguration\" 2 = {Class@3295} \"interface org.springframework.stereotype.Indexed\" 6 = {Collections$UnmodifiableRandomAccessList@4759} size = 3 0 = {Class@3479} \"interface org.springframework.boot.autoconfigure.SpringBootApplication\" 1 = {Class@3502} \"interface org.springframework.boot.autoconfigure.EnableAutoConfiguration\" 2 = {Class@3525} \"interface org.springframework.boot.autoconfigure.AutoConfigurationPackage\" 7 = {Collections$UnmodifiableRandomAccessList@4760} size = 3 0 = {Class@3479} \"interface org.springframework.boot.autoconfigure.SpringBootApplication\" 1 = {Class@3502} \"interface org.springframework.boot.autoconfigure.EnableAutoConfiguration\" 2 = {Class@3491} \"interface org.springframework.context.annotation.Import\" 8 = {Collections$UnmodifiableRandomAccessList@4761} size = 4 0 = {Class@3479} \"interface org.springframework.boot.autoconfigure.SpringBootApplication\" 1 = {Class@3506} \"interface org.springframework.boot.SpringBootConfiguration\" 2 = {Class@3505} \"interface org.springframework.context.annotation.Configuration\" 3 = {Class@3524} \"interface org.springframework.stereotype.Component\" 9 = {Collections$UnmodifiableRandomAccessList@4762} size = 4 0 = {Class@3479} \"interface org.springframework.boot.autoconfigure.SpringBootApplication\" 1 = {Class@3502} \"interface org.springframework.boot.autoconfigure.EnableAutoConfiguration\" 2 = {Class@3525} \"interface org.springframework.boot.autoconfigure.AutoConfigurationPackage\" 3 = {Class@3491} \"interface org.springframework.context.annotation.Import\" 10 = {Collections$UnmodifiableRandomAccessList@4763} size = 5 0 = {Class@3479} \"interface org.springframework.boot.autoconfigure.SpringBootApplication\" 1 = {Class@3506} \"interface org.springframework.boot.SpringBootConfiguration\" 2 = {Class@3505} \"interface org.springframework.context.annotation.Configuration\" 3 = {Class@3524} \"interface org.springframework.stereotype.Component\" 4 = {Class@3295} \"interface org.springframework.stereotype.Indexed\"
listeners.contextPrepared
prepareEnvironment
getEnvironment().validateRequiredProperties()
priorityOrderedPostProcessors
boot.SpringApplication#configureEnvironment
ApplicationPreparedEvent
invokeBeanFactoryPostProcessors
\"org.springframework.boot.BootstrapRegistryInitializer\" -> \
initLifecycleProcessor
ApplicationStartedEvent
0 = \"org.springframework.boot.context.config.DelegatingApplicationContextInitializer\"1 = \"org.springframework.boot.autoconfigure.SharedMetadataReaderFactoryContextInitializer\"2 = \"org.springframework.boot.context.ContextIdApplicationContextInitializer\"3 = \"org.springframework.boot.context.ConfigurationWarningsApplicationContextInitializer\"4 = \"org.springframework.boot.rsocket.context.RSocketPortInfoApplicationContextInitializer\"5 = \"org.springframework.boot.web.context.ServerPortInfoApplicationContextInitializer\"6 = \"org.springframework.boot.autoconfigure.logging.ConditionEvaluationReportLoggingListener\"
ApplicationEnvironmentPreparedEvent
\"org.springframework.boot.sql.init.dependency.DatabaseInitializerDetector\" -> \"org.springframework.boot.autoconfigure.flyway.FlywayMigrationInitializerDatabaseInitializerDetector\"\"org.springframework.boot.autoconfigure.template.TemplateAvailabilityProvider\" -> \
0 = {SharedMetadataReaderFactoryContextInitializer$CachingMetadataReaderFactoryPostProcessor@4186} 1 = {ConfigurationWarningsApplicationContextInitializer$ConfigurationWarningsPostProcessor@4190}
customizePropertySources
【defaultProfiles】[0 = \"default\"]
META-INF/spring.factories
finishBeanFactoryInitialization
boot.context.event.EventPublishingRunListener#environmentPrepared
0 = {RefreshScope@4816}
DefaultListableBeanFactory
boot.context.properties.source.ConfigurationPropertySources#attach
allowCircularReferences=false 循环依赖
BootstrapContextClosedEvent
earlyApplicationListeners
shutdownHook
jar:file:/C:/repository/org/springframework/cloud/spring-cloud-commons/3.1.3/spring-cloud-commons-3.1.3.jar!/META-INF/spring.factories
earlyApplicationEvents
prepareBeanFactory
context.annotation.internalConfigurationAnnotationProcessor
0 = \"org.springframework.cloud.netflix.eureka.EurekaDiscoveryClientConfiguration$EurekaClientConfigurationRefresher\"1 = \"org.springframework.boot.autoconfigure.web.servlet.ServletWebServerFactoryConfiguration$EmbeddedTomcat\"2 = \"org.springframework.cloud.netflix.eureka.EurekaClientAutoConfiguration$RefreshableEurekaClientConfiguration\"3 = \"org.springframework.cloud.client.discovery.simple.SimpleDiscoveryClientAutoConfiguration\"4 = \"org.springframework.cloud.commons.httpclient.HttpClientConfiguration\"5 = \"org.springframework.boot.autoconfigure.web.servlet.MultipartAutoConfiguration\"6 = \"org.springframework.boot.autoconfigure.security.servlet.SpringBootWebSecurityConfiguration$SecurityFilterChainConfiguration\"7 = \"org.springframework.boot.autoconfigure.web.servlet.DispatcherServletAutoConfiguration$DispatcherServletRegistrationConfiguration\"8 = \"org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration$JacksonObjectMapperBuilderConfiguration\"9 = \"org.springframework.cloud.client.serviceregistry.ServiceRegistryAutoConfiguration\"10 = \"org.springframework.cloud.autoconfigure.LifecycleMvcEndpointAutoConfiguration\"11 = \"org.springframework.boot.autoconfigure.aop.AopAutoConfiguration$AspectJAutoProxyingConfiguration\"12 = \"org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration\"13 = \"org.springframework.security.config.annotation.configuration.ObjectPostProcessorConfiguration\"14 = \"org.springframework.security.config.annotation.authentication.configuration.AuthenticationConfiguration\"15 = \"org.springframework.cloud.netflix.eureka.loadbalancer.LoadBalancerEurekaAutoConfiguration\"17 = \"org.springframework.cloud.client.loadbalancer.LoadBalancerDefaultMappingsProviderAutoConfiguration\"18 = \"weixinCPWebController\"19 = \"org.springframework.boot.autoconfigure.web.embedded.EmbeddedWebServerFactoryCustomizerAutoConfiguration$TomcatWebServerFactoryCustomizerConfiguration\"20 = \"org.springframework.boot.autoconfigure.admin.SpringApplicationAdminJmxAutoConfiguration\"21 = \"org.springframework.cloud.client.loadbalancer.AsyncLoadBalancerAutoConfiguration$LoadBalancerInterceptorConfig\"22 = \"org.springframework.boot.autoconfigure.web.client.RestTemplateAutoConfiguration\"23 = \"cpConfig\"24 = \"org.springframework.cloud.client.ReactiveCommonsClientAutoConfiguration\"25 = \"org.springframework.boot.autoconfigure.sql.init.SqlInitializationAutoConfiguration\"26 = \"org.springframework.boot.autoconfigure.web.embedded.EmbeddedWebServerFactoryCustomizerAutoConfiguration\"27 = \"org.springframework.boot.autoconfigure.aop.AopAutoConfiguration$AspectJAutoProxyingConfiguration$CglibAutoProxyConfiguration\"28 = \"org.springframework.cloud.loadbalancer.config.LoadBalancerCacheAutoConfiguration$LoadBalancerCacheManagerWarnConfiguration\"29 = \"org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration\"30 = \"org.springframework.cloud.autoconfigure.RefreshAutoConfiguration\"31 = \"org.springframework.boot.autoconfigure.websocket.servlet.WebSocketServletAutoConfiguration$TomcatWebSocketConfiguration\"32 = \"org.springframework.boot.autoconfigure.security.servlet.SecurityFilterAutoConfiguration\"33 = \"org.springframework.boot.autoconfigure.http.HttpMessageConvertersAutoConfiguration\"34 = \"org.springframework.cloud.commons.util.UtilAutoConfiguration\"35 = \"org.springframework.cloud.netflix.eureka.EurekaClientAutoConfiguration\"36 = \"org.springframework.cloud.client.loadbalancer.AsyncLoadBalancerAutoConfiguration\"37 = \"org.springframework.cloud.commons.config.CommonsConfigAutoConfiguration\"38 = \"org.springframework.boot.autoconfigure.websocket.servlet.WebSocketServletAutoConfiguration\"39 = \"org.springframework.boot.autoconfigure.gson.GsonAutoConfiguration\"40 = \"org.springframework.cloud.openfeign.loadbalancer.DefaultFeignLoadBalancerConfiguration\"41 = \"org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration\"42 = \"org.springframework.cloud.configuration.CompatibilityVerifierAutoConfiguration\"43 = \"org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration$Jackson2ObjectMapperBuilderCustomizerConfiguration\"44 = \"org.springframework.boot.autoconfigure.http.HttpMessageConvertersAutoConfiguration$StringHttpMessageConverterConfiguration\"45 = \"org.springframework.boot.autoconfigure.availability.ApplicationAvailabilityAutoConfiguration\"47 = \"org.springframework.cloud.commons.httpclient.HttpClientConfiguration$ApacheHttpClientConfiguration\"48 = \"org.springframework.boot.autoconfigure.task.TaskExecutionAutoConfiguration\"49 = \"org.springframework.boot.autoconfigure.aop.AopAutoConfiguration\"50 = \"org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration\"51 = \"org.springframework.boot.autoconfigure.web.servlet.DispatcherServletAutoConfiguration\"52 = \"org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration\"53 = \"org.springframework.boot.autoconfigure.web.servlet.ServletWebServerFactoryAutoConfiguration\"54 = \"org.springframework.boot.autoconfigure.security.servlet.SpringBootWebSecurityConfiguration\"55 = \"org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration$EnableWebMvcConfiguration\"56 = \"org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter\"57 = \"org.springframework.cloud.openfeign.FeignAutoConfiguration$DefaultFeignTargeterConfiguration\"58 = \"org.springframework.cloud.netflix.eureka.EurekaDiscoveryClientConfiguration\"59 = \"org.springframework.boot.autoconfigure.security.servlet.SpringBootWebSecurityConfiguration$WebSecurityEnablerConfiguration\"61 = \"org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration$DefaultErrorViewResolverConfiguration\"62 = \"org.springframework.boot.autoconfigure.security.servlet.SpringBootWebSecurityConfiguration$ErrorPageSecurityFilterConfiguration\"63 = \"org.springframework.cloud.netflix.eureka.config.DiscoveryClientOptionalArgsConfiguration\"64 = \"org.springframework.cloud.loadbalancer.config.LoadBalancerCacheAutoConfiguration\"65 = \"org.springframework.boot.autoconfigure.http.JacksonHttpMessageConvertersConfiguration\"66 = \"org.springframework.cloud.autoconfigure.RefreshAutoConfiguration$RefreshScopeBeanDefinitionEnhancer\"67 = \"org.springframework.cloud.client.discovery.composite.CompositeDiscoveryClientAutoConfiguration\"68 = \"org.springframework.cloud.client.serviceregistry.AutoServiceRegistrationConfiguration\"69 = \"org.springframework.boot.autoconfigure.security.servlet.UserDetailsServiceAutoConfiguration\"70 = \"org.springframework.cloud.openfeign.FeignAutoConfiguration\"72 = \"consumerApplication\"74 = \"org.springframework.boot.autoconfigure.web.servlet.HttpEncodingAutoConfiguration\"75 = \"org.springframework.boot.autoconfigure.context.LifecycleAutoConfiguration\"76 = \"org.springframework.boot.autoconfigure.http.JacksonHttpMessageConvertersConfiguration$MappingJackson2HttpMessageConverterConfiguration\"77 = \"org.springframework.boot.autoconfigure.http.GsonHttpMessageConvertersConfiguration\"78 = \"org.springframework.cloud.client.loadbalancer.LoadBalancerAutoConfiguration\"79 = \"org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration\"80 = \"org.springframework.cloud.client.serviceregistry.AutoServiceRegistrationAutoConfiguration\"81 = \"org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration$JacksonObjectMapperConfiguration\"82 = \"org.springframework.cloud.loadbalancer.config.BlockingLoadBalancerClientAutoConfiguration\"83 = \"org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration$WhitelabelErrorViewConfiguration\"84 = \"weixinCpController\"85 = \"org.springframework.boot.autoconfigure.web.servlet.DispatcherServletAutoConfiguration$DispatcherServletConfiguration\"87 = \"org.springframework.boot.autoconfigure.jmx.JmxAutoConfiguration\"88 = \"org.springframework.cloud.client.loadbalancer.LoadBalancerAutoConfiguration$LoadBalancerInterceptorConfig\"89 = \"org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration\"91 = \"org.springframework.boot.autoconfigure.context.ConfigurationPropertiesAutoConfiguration\"92 = \"org.springframework.security.config.annotation.web.configuration.HttpSecurityConfiguration\"93 = \"org.springframework.security.config.annotation.web.configuration.WebMvcSecurityConfiguration\"94 = \"org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration$ParameterNamesModuleConfiguration\"95 = \"org.springframework.cloud.client.CommonsClientAutoConfiguration\"96 = \"org.springframework.cloud.openfeign.loadbalancer.FeignLoadBalancerAutoConfiguration\"97 = \"consumerController\"98 = \"org.springframework.boot.autoconfigure.task.TaskSchedulingAutoConfiguration\"99 = \"org.springframework.cloud.loadbalancer.config.LoadBalancerCacheAutoConfiguration$DefaultLoadBalancerCacheManagerConfiguration\"101 = \"org.springframework.cloud.loadbalancer.config.LoadBalancerAutoConfiguration\"102 = \"org.springframework.cloud.client.loadbalancer.AsyncLoadBalancerAutoConfiguration$AsyncRestTemplateCustomizerConfig\"103 = \"org.springframework.boot.autoconfigure.info.ProjectInfoAutoConfiguration\"
⭐️2023.04.23 SpringBoot自动配置源码解析https://www.processon.com/view/link/6444f93b84b4b71c14ff3fa3
BeanDefinitionRegistryPostProcessor.postProcessBeanDefinitionRegistry(BeanDefinitionRegistry)
EnvironmentPostProcessorApplicationListener
web.context.support.WebApplicationContextUtils#registerWebApplicationScopes()
scanner
org.springframework.beans.BeanInfoFactory -> org.springframework.beans.ExtendedBeanInfoFactory
reader.loadBeanDefinitions
parser.parse(candidates);
context.annotation.ConfigurationClassPostProcessor#postProcessBeanFactory
[Invoke BeanDefinitionRegistryPostProcessors first]BeanDefinitionRegistryPostProcessor
0 = {ConfigurationPropertySourcesPropertySource@2640} \"ConfigurationPropertySourcesPropertySource {name='configurationProperties'}\"1 = {SimpleCommandLinePropertySource@2552} \"SimpleCommandLinePropertySource {name='commandLineArgs'}\"2 = {PropertySource$StubPropertySource@2526} \"StubPropertySource {name='servletConfigInitParams'}\"3 = {PropertySource$StubPropertySource@2527} \"StubPropertySource {name='servletContextInitParams'}\"4 = {PropertiesPropertySource@2528} \"PropertiesPropertySource {name='systemProperties'}\"5 = {SystemEnvironmentPropertySource@2529} \"SystemEnvironmentPropertySource {name='systemEnvironment'}\"
ApplicationListener
initPropertySources
ApplicationStartingEvent
jar:file:/C:/repository/org/springframework/boot/spring-boot/2.7.2/spring-boot-2.7.2.jar!/META-INF/spring.factories
EnvironmentPostProcessor
invokeBeanDefinitionRegistryPostProcessors
mainApplicationClass = deduceMainApplicationClass()
jar:file:/C:/repository/org/springframework/cloud/spring-cloud-loadbalancer/3.1.3/spring-cloud-loadbalancer-3.1.3.jar!/META-INF/spring.factories
prepareContext
createWebServer
listeners.environmentPrepared
【SimpleApplicationEventMulticaster】0 = {BootstrapApplicationListener@2553} 1 = {LoggingSystemShutdownListener@2554} 2 = {EnvironmentPostProcessorApplicationListener@2555} 3 = {AnsiOutputApplicationListener@2556} 4 = {LoggingApplicationListener@2184} 5 = {BackgroundPreinitializer@2205} 6 = {DelegatingApplicationListener@2208} 7 = {FileEncodingApplicationListener@2557}
nonOrderedPostProcessors
post-initialization callback for all applicable beans
onRefresh
listeners.ready
GenericConverter
allowBeanDefinitionOverriding=falsebean定义覆盖
0 = {Class@3431} \"interface org.springframework.context.ApplicationStartupAware\"1 = {Class@1833} \"interface org.springframework.beans.factory.BeanClassLoaderAware\"2 = {Class@3626} \"interface org.springframework.beans.factory.BeanNameAware\"3 = {Class@3570} \"interface org.springframework.context.EnvironmentAware\"4 = {Class@4453} \"interface org.springframework.context.ApplicationEventPublisherAware\"5 = {Class@1941} \"interface org.springframework.context.EmbeddedValueResolverAware\"6 = {Class@1761} \"interface org.springframework.context.ApplicationContextAware\"7 = {Class@1834} \"interface org.springframework.beans.factory.BeanFactoryAware\"8 = {Class@4454} \"interface org.springframework.context.MessageSourceAware\"9 = {Class@3290} \"interface org.springframework.context.ResourceLoaderAware\"
0 = \"org.springframework.context.annotation.internalConfigurationAnnotationProcessor\"1 = \"org.springframework.cloud.autoconfigure.RefreshAutoConfiguration$RefreshScopeBeanDefinitionEnhancer\"2 = \"refreshScope\"
initMessageSource
web.context.support.StandardServletEnvironment#customizePropertySources
defaultProperties
registerResolvableDependency
List<SpringApplicationRunListener> listeners
ApplicationRunner
annotatedReader
registerListeners
beanPostProcessors
bootstrapContext.close
0 = \"org.springframework.cloud.bootstrap.BootstrapApplicationListener\"1 = \"org.springframework.cloud.bootstrap.LoggingSystemShutdownListener\"2 = \"org.springframework.boot.env.EnvironmentPostProcessorApplicationListener\"3 = \"org.springframework.boot.context.config.AnsiOutputApplicationListener\"4 = \"org.springframework.boot.context.logging.LoggingApplicationListener\"5 = \"org.springframework.boot.autoconfigure.BackgroundPreinitializer\"6 = \"org.springframework.boot.context.config.DelegatingApplicationListener\"7 = \"org.springframework.cloud.context.restart.RestartListener\"8 = \"org.springframework.boot.builder.ParentContextCloserApplicationListener\"9 = \"org.springframework.boot.ClearCachesApplicationListener\"10 = \"org.springframework.boot.context.FileEncodingApplicationListener\"
CommandLineRunner
ApplicationContextInitializer.initialize()
0 = {PropertySource$StubPropertySource@2418} \"StubPropertySource {name='servletConfigInitParams'}\"1 = {PropertySource$StubPropertySource@2419} \"StubPropertySource {name='servletContextInitParams'}\"
0 = {SimpleCommandLinePropertySource@2421} \"SimpleCommandLinePropertySource {name='commandLineArgs'}\"1 = {PropertySource$StubPropertySource@2150} \"StubPropertySource {name='servletConfigInitParams'}\"2 = {PropertySource$StubPropertySource@2151} \"StubPropertySource {name='servletContextInitParams'}\"3 = {PropertiesPropertySource@2152} \"PropertiesPropertySource {name='systemProperties'}\"4 = {SystemEnvironmentPropertySource@2153} \"SystemEnvironmentPropertySource {name='systemEnvironment'}\"
AbstractEnvironment
postProcessBeanFactory
beanFactory
\"org.springframework.boot.sql.init.dependency.DatabaseInitializerDetector\" -> \
orderedPostProcessors
beanFactory.preInstantiateSingletons()
publishEvent(new ContextRefreshedEvent(this))
0 = {RandomValuePropertySourceEnvironmentPostProcessor@2795} 1 = {CachedRandomPropertySourceEnvironmentPostProcessor@2796} 2 = {SystemEnvironmentPropertySourceEnvironmentPostProcessor@2797} 3 = {SpringApplicationJsonEnvironmentPostProcessor@2798} 4 = {CloudFoundryVcapEnvironmentPostProcessor@2799} 5 = {HostInfoEnvironmentPostProcessor@2800} 6 = {ConfigDataEnvironmentPostProcessor@2801} 7 = {DebugAgentEnvironmentPostProcessor@2802} 8 = {IntegrationPropertiesEnvironmentPostProcessor@2803} 9 = {DecryptEnvironmentPostProcessor@2804}
0 = {SharedMetadataReaderFactoryContextInitializer$CachingMetadataReaderFactoryPostProcessor@4186} 1 = {ConfigurationWarningsApplicationContextInitializer$ConfigurationWarningsPostProcessor@4190} 2 = {SpringApplication$PropertySourceOrderingBeanFactoryPostProcessor@4191}
invoke all other BeanDefinitionRegistryPostProcessors until no further ones appear
registerWebApplicationScopes
initApplicationEventMulticaster
jar:file:/C:/repository/org/springframework/boot/spring-boot-autoconfigure/2.7.2/spring-boot-autoconfigure-2.7.2.jar!/META-INF/spring.factories
postProcessApplicationContext
obtainFreshBeanFactory
0 条评论
下一页