ApplicationContext的refresh
2021-07-09 14:21:15 1 举报
spring application context 的refresh
作者其他创作
大纲/内容
new DefaultListableBeanFactory(getInternalParentBeanFactory())
好像非单例bean,Spring不管其生命周期
refresh()
createBeanFactory
loadBeanDefinitions
environment.initPropertySources()
AnnotatedBeanDefinitionReader
loadBeanDefinitions(beanDefinitionReader);
hasBeanFactory()已经有bean的定义了
prepareRefresh()
registerBean
AnnotationConfigWebApplicationContext
loadBeanDefinitions(DefaultListableBeanFactory beanFactory)
AbstractApplicationContext
new StandardEnvironment()
addBeanPostProcessor
getEnvironment()
customizeBeanFactory 这个方法用来设置是否允许重复的BeanDefinition以及是否允许循环依赖 ???
XmlBeanDefinitionReader
setPrimary,setLazyInit
XmlApplicationContext
prepareBeanFactory
closed =falseactive = true
setBeanClassLoader
setScope
obtainFreshBeanFactory
reader.register(clazz);
createEnvironment
initPropertySources
doRegisterBean
destroyBeanscloseBeanFactory就先销毁(单例)bean,并关闭bean工厂
0 条评论
下一页