seaswalker / spring-analysis

Spring源码阅读
13.54k stars 4.18k forks source link

纠正postProcessMergedBeanDefinition方法的执行时机的描述 #13

Closed rocky-peng closed 4 years ago

rocky-peng commented 4 years ago

纠正MergedBeanDefinitionPostProcessor.postProcessMergedBeanDefinition方法的执行时机的描述

protected Object doCreateBean(final String beanName, final RootBeanDefinition mbd, final Object[] args) {
    // Instantiate the bean.
    BeanWrapper instanceWrapper = null;
    if (mbd.isSingleton()) {
        instanceWrapper = this.factoryBeanInstanceCache.remove(beanName);
    }
    if (instanceWrapper == null) {

        //createBeanInstance方法已经创建了实例
        instanceWrapper = createBeanInstance(beanName, mbd, args);
    }
    final Object bean = (instanceWrapper != null ? instanceWrapper.getWrappedInstance() : null);
    Class<?> beanType = (instanceWrapper != null ? instanceWrapper.getWrappedClass() : null);
    // Allow post-processors to modify the merged bean definition.
    synchronized (mbd.postProcessingLock) {
        if (!mbd.postProcessed) {
            applyMergedBeanDefinitionPostProcessors(mbd, beanType, beanName);
            mbd.postProcessed = true;
        }
    }
}   

代码中createBeanInstance方法已经创建了实例

seaswalker commented 4 years ago

谢谢