spring ioc流程图
2021-09-28 14:03:10 0 举报
spring ioc加载流程
作者其他创作
大纲/内容
ApplicationContextAware
@PostConstruct
isInCreation
determineCandidateConstructors
通过配置指定的方法
@AutoWired @Value预解析InjectionMetadata
坦克图纸
将概念bean扫描成定义态
postProcessAfterInstantiation
XML配置(<bean>)注解配置(@Component)JavaConfig(@Configuration)
BeanDefinitionMap
addSingleton()
postProcessAfterInitalization
extends
①
BeanNameAware
实例化 Instantiation
初始化后的工作AOP:创建代理
doCreateBean()
setxx
InitializingBean
被注解标注的方法
yes
终止赋值流程
scope
singletonFactories
BeanClassLoaderAware
Spring 5.3.X
autowireMode
ClassLoader
MessageSourceAware
setBeanClassLoader
如果符合生产标准
EnvironmentAware
......
注册定义信息
no
DestructionAwareBeanPostProcessor
BeanFactoryAware
标记正在创建中为了解决循环依赖
指定实例化的构造函数
SUV
BeanPostProcess
classname
扩展点——初始化生命周期的回调方法
关闭容器 close()
②
setBeanName
setEnvironment
MergedBeanDefinitionPostProcessor
ApplicationEventPublisherAware
destroy-method
getEarlyBeanReference
创建完成
一级缓存
singletonObjects
initMethodName
InstantiationAwareBeanPostProcessor
属性赋值 populate
特殊车辆
初始化 Initialization
inti
EmbeddedValueResolverAware
SmartInstantiationAwareBeanPostProcessor
postProcessMergedBeanDefinition
DisposableBean
SmartINstantiationAwareBeanPostProcessor
BeanFactoryPostProcessor
postProcessAfterInitialization
解决循环引用、以及循环引用下的AOP分别有两个后置处理器去处理
初始化的生命周期接口调用
bean的后置处理器9处调用
MessagesSourceAware
添加到inCreationcreateBean()
提供扩展点操控bean定义
类加载Car.classTank.class
application.close()
afterPropertiesSet
postProcessBeforeInitialization
销毁
init-method
earlySingletonObjects
BeanPostProcessors
invokeBeanFactoryPostProcessors
修改定义信息
BeanDefinition
@PreDestroy
dependonsOn
postProcessBeforeInstantiation
lazyInit
普通车辆
requiresDestruction
invokeAwareMethods
可直接返回bean停止创建AOP解析切面
注入属性PropertyValues@AutoWired在这里DI
ResourceLoaderAware
跑车
循环依赖二、三级缓存
setBeanFactory
ApplicationContextAwareProcessorpostProcessBeforeInitialization
AbstractBeanFactory.getBean()
BeanDefinitionRegistryPostProcessor
destroy
③
postProcessPropertyValues
初始化前的工作 调用@PostConstruct
收藏
0 条评论
回复 删除
下一页