sxd-spring启动
2022-09-23 16:16:49 23 举报
AI智能生成
sxd-spring启动
作者其他创作
大纲/内容
启动
AbstractApplicationContext#resourceLoader
AbstractApplicationContext#parent 为空
super(parent)
new StandardEnvironment()
getEnvironment()
AbstractRefreshableConfigApplicationContext#resolvePath()
AbstractRefreshableConfigApplicationContext#configLocations
AbstractRefreshableConfigApplicationContext#setconfiglocations()
setConfigLocations ()设置文件加载并加载bean定义
prepareRefresh()前戏
destroyBeans()
closeBeanFactory()
hasBeanFactory()
getInternalParentBeanFactory()
new DefaultListableBeanFactory(null)
beanFactory=createBeanFactory()
beanFactory.setSerializationId(getId())
customizeBeanFactory(beanFactory)
new XmlBeanDefinitionReader初始化读取器
doLoadDocument读取xml为文档
createDefaultNamespaceHandlerResolver
getNamespaceHandlerResolver
createReaderContext
parseBeanDefinitionElement
decorateBeanDefinitionIfRequired
registerBeanDefinition()实际调用DefaultListableBeanFactory的方法
fireComponentRegistered
GenericBeanDefinition
parseDefaultElement()
子主题
getHandlerMappings
namespaceHandler.init();
this.readerContext.getNamespaceHandlerResolver().resolve(namespaceUri);
configureScanner
getMetadataReaderFactory().getMetadataReader(resource)
ScannedGenericBeanDefinition
isCandidateComponent
scanCandidateComponents
findCandidateComponents
registerBeanDefinition
scanner.doScan
注册后置处理组件 registerComponents
findParserForElement
NamespaceHandlerSupport#parse
delegate.parseCustomElement(ele)
delegate.parseCustomElement(root)
registerBeanDefinitions解析文档注册bean
XmlBeanDefinitionReader#doLoadBeanDefinitions
AbstractBeanDefinitionReader#loadBeanDefinitions(java.lang.String...)
loadBeanDefinitions(beanDefinitionReader)
AbstractXmlApplicationContext#loadBeanDefinitions()
AnnotationConfigWebApplicationContext
GroovyWebApplicationContext
XmlWebApplicationContext
loadBeanDefinitions(beanFactory)适配器模式
this.beanFactory = beanFactory
refreshBeanFactory()
getBeanFactory()
obtainFreshBeanFactory()创建工厂并加载beanDefinition
setBeanClassLoader(getClassLoader())
setBeanExpressionResolver
addPropertyEditorRegistrar
addBeanPostProcessor
设置忽略接口ignoreDependencyInterface
registerResolvableDependency
registerSingleton
prepareBeanFactory(beanFactory)工厂的预初始化操作
postProcessBeanFactory(beanFactory)扩展接口
beanFactory.getBeanNamesForType(BeanDefinitionRegistryPostProcessor.class
processMemberClasses
addPropertySource
processPropertySource
componentScanParser.parse
ConfigurationClassUtils
parse
Process@ComponentScan
getImports
ImportSelector
ImportBeanDefinitionRegistrar
other
processImports
process @ImportResource
retrieveBeanMethodMetadata
process @Bean
processInterfaces
Process superclass
doProcessConfigurationClass
processConfigurationClass()
getCandidateConfigurations()
loadSpringFactories
getOrDefault
loadFactoryNames
AutoConfigurationImportSelector
group.process
grouping.getImports()
processGroupImports
deferredImportSelectorHandler.process
registerBeanDefinitionForImportedConfigurationClass
loadBeanDefinitionsForBeanMethod
GroovyBeanDefinitionReader
XmlBeanDefinitionReader
reader.loadBeanDefinitions
loadBeanDefinitionsFromImportedResources
loadBeanDefinitionsFromRegistrars
loadBeanDefinitionsForConfigurationClass
processConfigBeanDefinitions
ConfigurationClassPostProcessor
invokeBeanFactoryPostProcessors()
invokeBeanFactoryPostProcessors(beanFactory)调用bean的后置处理方法,在bean实例化之前
registerBeanPostProcessors()
registerBeanPostProcessors(beanFactory);注册bean创建的拦截处理器
initMessageSource()初始化消息源
initApplicationEventMulticaster()初始化事件
onRefresh()其他特殊bean
registerListeners()注册侦听器
setConversionService
addEmbeddedValueResolver
beanFactory.getBeanNamesForType(LoadTimeWeaverAware
beanFactory.setTempClassLoader
beanFactory.freezeConfiguration
alreadyCreated.add(beanName)
mbd.isPrototype()
else
getBean(FACTORY_BEAN_PREFIX + beanName)
getBean(beanName)
isFactoryBean
for1
for2
preInstantiateSingletons
beanFactory.preInstantiateSingletons
finishBeanFactoryInitialization(beanFactory)实例化所有剩余的(非惰性初始化)单例
finishRefresh()发布相应的事件
refresh()
transformedBeanName(name)
getSingleton
parentBeanFactory
markBeanAsCreated
getMergedLocalBeanDefinition
dependsOn
evaluateBeanDefinitionString
ClassUtils.forName
mbd.resolveBeanClass
doResolveBeanClass
mbdToUse.prepareMethodOverrides();
resolveBeforeInstantiation
mbd.isSingleton
resolveBeanClass
mbd.getInstanceSupplier();
obtainFromSupplier
instanceSupplier
mbd.getFactoryMethodName
instantiateUsingFactoryMethod
autowireConstructor
determineConstructorsFromBeanPostProcessors
BeanUtils.instantiateClass
CglibSubclassingInstantiationStrategy#instantiate
instantiateWithMethodInjection
SimpleInstantiationStrategy#instantiate
new BeanWrapperImpl(beanInstance)
initBeanWrapper(bw);
instantiateBean
createBeanInstance
instanceWrapper.getWrappedInstance()
instanceWrapper.getWrappedClass()
JmsListenerAnnotationBeanPostProcessor
ScheduledAnnotationBeanPostProcessor
RequiredAnnotationBeanPostProcessor
buildLifecycleMetadata
findLifecycleMetadata
beanDefinition.registerExternallyManagedInitMethod(methodIdentifier);
beanDefinition.registerExternallyManagedDestroyMethod(methodIdentifier);
checkConfigMembers
super.postProcessMergedBeanDefinition
field.isAnnotationPresent(webServiceRefClass)
field.isAnnotationPresent(ejbClass)
field.isAnnotationPresent(Resource.class)
buildResourceMetadata
injectionMetadataCache.put
findResourceMetadata
beanDefinition.registerExternallyManagedConfigMember
CommonAnnotationBeanPostProcessor
InitDestroyAnnotationBeanPostProcessor
buildAutowiringMetadata
findAutowiringMetadata
AutowiredAnnotationBeanPostProcessor
ApplicationListenerDetector
PersistenceAnnotationBeanPostProcessor
applyMergedBeanDefinitionPostProcessors
addSingletonFactory
postProcessAfterInstantiation
hasInstantiationAwareBeanPostProcessors
unsatisfiedNonSimpleProperties
containsBean(propertyName)
getBean
registerDependentBean
for -> propertyNames
autowireByName
autowireByType
mbd.getDependencyCheck
InjectionMetadata#inject
resolvedCachedArgument
createOptionalDependency
DependencyObjectProvider
createDependencyProvider
descriptor.resolveShortcut
resolveMultipleBeans
resolveCandidate
beanFactory.getBean
doResolveDependency
DefaultListableBeanFactory#resolveDependency
resolveFieldValue
AutowiredAnnotationBeanPostProcessor#inject
postProcessProperties
applyPropertyValues
populateBean
invokeAwareMethods
applyBeanPostProcessorsBeforeInitialization
invokeInitMethods
applyBeanPostProcessorsAfterInitialization
initializeBean
doCreateBean
AbstractAutowireCapableBeanFactory#createBean
BeanFactoryUtils.isFactoryDereference
getCachedObjectForFactoryBean
MyFactoryBean.getObject
doGetObjectFromFactoryBean
beforeSingletonCreation
afterSingletonCreation
postProcessObjectFromFactoryBean
singletonObjects
getObjectFromFactoryBean
getObjectForBeanInstance
doGetBean()
AbstractBeanFactory.doGetBean
AbstractBeanFactory#getBean(String name)
doGetBeanNamesForType
getBeanNamesForType
resolveNamedBean
getParentBeanFactory
resolveBean
DefaultListableBeanFactory#getBean(Class<T>)
ApplicationContext.getBean()
new ClassPathXmlApplicationContext
0 条评论
回复 删除
下一页