Spring流程
2021-12-30 10:57:06 0 举报
spring
作者其他创作
大纲/内容
BeanFactory
postProcessAfterInitialization
BeanPostProcessor
bean实例化用户自定义初始化方法init-method
bean定义信息
源码核心代码:AbstractApplicationContext.refresh()
PostProcessor
bean实例化
BeanFatoryPostProcessor
populateBean
new反射
***
不同阶段坐不同操作怎么办?观察者模式: 监听器 事件发布
ctx.getBean(\"XXX\")
执行aware接口实现方法
void postProcessBeanFactory(ConfigurableListableBeanFactory var1)
抽象层
属性填充通过set方法设置值
PlaceholderConfigurerSupport
xml
读取器
bean定义信息BeanDefinition
...
postProcessBeforeInitialization
注解
this.prepareRefresh(); --准备工作 ConfigurableListableBeanFactory beanFactory = this.obtainFreshBeanFactory(); this.prepareBeanFactory(beanFactory); this.postProcessBeanFactory(beanFactory); StartupStep beanPostProcess = this.applicationStartup.start(\"spring.context.beans.post-process\"); this.invokeBeanFactoryPostProcessors(beanFactory); this.registerBeanPostProcessors(beanFactory); beanPostProcess.end(); this.initMessageSource(); this.initApplicationEventMulticaster(); this.onRefresh(); this.registerListeners(); this.finishBeanFactoryInitialization(beanFactory); this.finishRefresh();
BeanDefinitionReader
完整对象
Container
Class clazz= Person.class;Constructor ctor = clazz.getConstructor();Object obj = ctor.newInstance();
AbstractApplicationContext.refresh()
Environment
后置处理器
0 条评论
下一页