diff --git a/youlai-laboratory/src/main/java/com/youlai/laboratory/spring/createBean.puml b/youlai-laboratory/src/main/java/com/youlai/laboratory/spring/createBean.puml index eb62925e0..802c5b0bf 100644 --- a/youlai-laboratory/src/main/java/com/youlai/laboratory/spring/createBean.puml +++ b/youlai-laboratory/src/main/java/com/youlai/laboratory/spring/createBean.puml @@ -9,17 +9,35 @@ header 有来 Spring bean的创建过程 actor 客户端 -客户端->AbstractBeanFactory:createBean -AbstractBeanFactory->AbstractBeanFactory:开始创建bean\ndoCreateBean -AbstractBeanFactory->AbstractBeanFactory:bena实例化\ncreateBeanInstance -AbstractBeanFactory->AbstractBeanFactory:执行beanDefinition的后置处理器\napplyMergedBeanDefinitionPostProcessors -AbstractBeanFactory->AbstractBeanFactory:属性填充\npopulateBean -AbstractBeanFactory->AbstractAutowireCapableBeanFactory:开始初始化\ninitializeBean +客户端->AbstractBeanFactory:getBean +AbstractBeanFactory->AbstractAutowireCapableBeanFactory:开始创建bean\ncreateBean +AbstractAutowireCapableBeanFactory->AbstractAutowireCapableBeanFactory:开始创建bean\ndoCreateBean +AbstractAutowireCapableBeanFactory->AbstractAutowireCapableBeanFactory:开始实例化\ncreateBeanInstance +AbstractAutowireCapableBeanFactory->AbstractBeanFactory:加载类\nresolveBeanClass +AbstractBeanFactory->AbstractAutowireCapableBeanFactory:\n返回beanClass + +AbstractAutowireCapableBeanFactory->AbstractAutowireCapableBeanFactory:如果满足循环依赖条件则加入三级缓存\naddSingletonFactory + +AbstractAutowireCapableBeanFactory->AbstractAutowireCapableBeanFactory:推断构造器\ndetermineConstructorsFromBeanPostProcessors +AbstractAutowireCapableBeanFactory->AbstractAutowireCapableBeanFactory:实例化bean并封装成beanWrapper\ninstantiateBean + +AbstractAutowireCapableBeanFactory->AbstractAutowireCapableBeanFactory:执行beanDefinition的后置处理器\napplyMergedBeanDefinitionPostProcessors +AbstractAutowireCapableBeanFactory->AbstractAutowireCapableBeanFactory:属性填充\npopulateBean +AbstractAutowireCapableBeanFactory->AbstractAutowireCapableBeanFactory:开始初始化\ninitializeBean AbstractAutowireCapableBeanFactory->AbstractAutowireCapableBeanFactory:执行Aware\ninvokeAwareMethods AbstractAutowireCapableBeanFactory->AbstractAutowireCapableBeanFactory:初始化前\napplyBeanPostProcessorsBeforeInitialization AbstractAutowireCapableBeanFactory->AbstractAutowireCapableBeanFactory:初始化\ninvokeInitMethods AbstractAutowireCapableBeanFactory->AbstractAutowireCapableBeanFactory:初始后\napplyBeanPostProcessorsAfterInitialization -AbstractAutowireCapableBeanFactory->AbstractBeanFactory:wrappedBean +AbstractAutowireCapableBeanFactory->AbstractAutowireCapableBeanFactory:初始后\nsingletonObject +AbstractAutowireCapableBeanFactory->DefaultSingletonBeanRegistry:\nexposedObject + +DefaultSingletonBeanRegistry->DefaultSingletonBeanRegistry:注册bean\naddSingleton +DefaultSingletonBeanRegistry->AbstractBeanFactory: sharedInstance + +AbstractBeanFactory->AbstractBeanFactory:获取给定bean的实例对象\ngetObjectForBeanInstance + +AbstractBeanFactory->AbstractBeanFactory:转换bean类型\nadaptBeanInstance + AbstractBeanFactory->客户端:\nbean @enduml