auto bean流程
2021-07-09 14:53:38 3 举报
auto bean流程
作者其他创作
大纲/内容
I:MergedBeanDefinitionPostProcessor
延迟加载的时候,通过这个来返回一个Bean的代理对象,当真正调用到bean方法时,才加载bean
AutowiredMethodElement是AutowiredAnnotationBeanPostProcessor的内部私有类,继承了InjectionMetadata.InjectedElement
metadata = findAutowiringMetadata
doCreateBean
applyBeanPostProcessorsBeforeInitialization
this.resolveMultipleBeans
Collection.class.isAssignableFrom(type)
createDependencyProvider
Map.class == type
initializeBean初始化bean
createBean
对每一个Beanpostprocessor均执行beanProcessor.postProcessAfterInitialization
applyMergedBeanDefinitionPostProcessors
Optional
把找到的bean返回给调用方,并且通过反射,并且将找到的Bean赋值给BeanWrapper的instance
AutowiredAnnotationBeanPostProcessor
Provider
DefaultListableBeanFactory
populateBean给bean属性赋值
this.doResolveDependency
findAutowireCandidates
resolveMethodArguments
postProcessMergedBeanDefinition方法,在类有父类的时候,将父类元信息(比如父类的字段)合并到类信息中,就是视频中superUser继承User
Lazy
通过AutowiredAnnotationBeanPostProcessor内部的ConfigurableListableBeanFactory 调用
applyBeanPostProcessorsAfterInitialization
resolveDependency
invokeInitMethods自定义的初始化方法
createOptionalDependency
resolveCachedArguments
postProcessProperties
type.isArray()
对每一个Beanpostprocessor均执行beanProcessor.postProcessBeforeInitialization
Normal
getLazyResolutionProxyIfNecessary
AbstractAutowireCapableBeanFactory
0 条评论
下一页