1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
DefaultListableBeanFactory.preInstantiateSingletons() DefaultListableBeanFactory.getBean DefaultListableBeanFactory.doGetBean DefaultListableBeanFactory.getSingleton DefaultListableBeanFactory.beforeSingletonCreation DefaultListableBeanFactory.createBean DefaultListableBeanFactory.createBeanInstance MergedBeanDefinitionPostProcessor.postProcessMergedBeanDefinition DefaultListableBeanFactory.populateBean AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues InjectionMetadata.inject AutowiredFieldElement.inject DefaultListableBeanFactory.resolveDependency DefaultListableBeanFactory.doResolveDependency DefaultListableBeanFactory.findAutowireCandidates DefaultListableBeanFactory.getBean DefaultListableBeanFactory.initializeBean DefaultListableBeanFactory.invokeAwareMethods BeanPostProcessor.postProcessBeforeInitialization InitializingBean.afterPropertiesSet BeanPostProcessor.postProcessAfterInitialization DefaultListableBeanFactory.registerDisposableBeanIfNecessary DefaultListableBeanFactory.afterSingletonCreation |
在beforeSingletonCreation() 方法中将正在创建的bean 放入列表中, 创建完后在afterSingletonCreation中建创建的bean从列表中删除, 用于解决循环依赖
populateBean()方法中,通过调用AutowiredAnnotationBeanPostProcessor 来完成@autowired注解的处理
initializeBean() 方法中, 先执行Aware接口, 主要执行InitializingBean.afterPropertiesSet 方法,当然BeanPostProcessor对应的before和after方法也得以正确的执行
Posted in: spring practise
Comments are closed.