概述
好处:可以获得当前类中的所有注解、属性、方法、构造器
* 对Aware类型进行判断,然后依次设定属性值
* @param beanName bean名称
* @param bean bean
*/
private void invokeAwareMethods(String beanName, Object bean) {
        if (bean instanceof Aware) {
                if (bean instanceof BeanNameAware) {
                        ((BeanNameAware) bean).setBeanName(beanName);
                }
                if (bean instanceof BeanClassLoaderAware) {
                        ClassLoader bcl = getBeanClassLoader();
                        if (bcl != null) {
                                ((BeanClassLoaderAware) bean).setBeanClassLoader(bcl);
                        }
                }
                if (bean instanceof BeanFactoryAware) {
                        ((BeanFactoryAware) bean).setBeanFactory(AbstractAutowireCapableBeanFactory.this);
                }
        }
}
protected final void refreshBeanFactory() throws BeansException {
        if (hasBeanFactory()) {
                destroyBeans();
                        closeBeanFactory();
        }
        try {
                //AbstractRefreshableApplicationContent#createBeanFactory()创建DefaultListableBeanFactory对象工厂
                DefaultListableBeanFactory beanFactory = createBeanFactory();
                //对BeanFactory设置序列化id
                beanFactory.setSerializationId(getId());
                //定制化BeanFactory,例如lookup-method、replace-method、是否允许被重写等
                customizeBeanFactory(beanFactory);
                //加载BeanDefinitions
                loadBeanDefinitions(beanFactory);
                //构建完成
                this.beanFactory = beanFactory;
        }
        catch (IOException ex) {
                throw new ApplicationContextException("I/O error parsing bean definition source for " + getDisplayName(), ex);
        }
}
* 将所有BeanFactoryPostProcessor实例化
* Instantiate and invoke all registered BeanFactoryPostProcessor beans,
* respecting explicit order if given.
*
Must be called before singleton instantiation.
*/
protected void invokeBeanFactoryPostProcessors(ConfigurableListableBeanFactory beanFactory)
{
        PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(beanFactory,
getBeanFactoryPostProcessors());
        // Detect a LoadTimeWeaver and prepare for weaving, if
found in the meantime
        // (e.g. through an @Bean method registered by
ConfigurationClassPostProcessor)
        if (!NativeDetector.inNativeImage() &&
beanFactory.getTempClassLoader() == null &&
beanFactory.containsBean(LOAD_TIME_WEAVER_BEAN_NAME)) {
                beanFactory.addBeanPostProcessor(new
LoadTimeWeaverAwareProcessor(beanFactory));
                beanFactory.setTempClassLoader(new
ContextTypeMatchClassLoader(beanFactory.getBeanClassLoader()));
        }
}
eg. PlaceHolderConfigurerSupport : spEl表达式的解析