Spring 中的 refresh
2020-05-14 15:20:32 0 举报
AI智能生成
Spring 中的refresh
作者其他创作
大纲/内容
refresh
prepareRefresh
initPropertySources();
子类实现
getEnvironment().validateRequiredProperties();
ConfigurableListableBeanFactory beanFactory = obtainFreshBeanFactory();
refreshBeanFactory();
子类复写
prepareBeanFactory(beanFactory);
beanFactory.setBeanClassLoader
\tbeanFactory.setBeanExpressionResolver
beanFactory.addPropertyEditorRegistrar
beanFactory.addBeanPostProcessor
\tbeanFactory.ignoreDependencyInterface
beanFactory.registerResolvableDependency
beanFactory.registerSingleton
postProcessBeanFactory
invokeBeanFactoryPostProcessors
registerBeanPostProcessors
initMessageSource
初始化MessageSource。 父容器中有则使用父亲的,没有则自己定义
initApplicationEventMulticaster
onRefresh
registerListeners
添加那些实现了 ApplicationListener 的类,作为监听器
getApplicationEventMulticaster().addApplicationListenerBean(listenerBeanName);
finishBeanFactoryInitialization
完成BeanFactory的初始化
*getBean(weaverAwareName);
finishRefresh
clearResourceCaches
initLifecycleProcessor
getLifecycleProcessor().onRefresh();
\tpublishEvent(new ContextRefreshedEvent(this));
\tLiveBeansView.registerApplicationContext(this);
destroyBeans
cancelRefresh
收藏
收藏
0 条评论
回复 删除
下一页