Spring源码解析之Configuration注解

1、Spring有一个内部的BeanFactoryPostProcessor:

  org.springframework.context.annotation.internalConfigurationAnnotationProcessor (id)

    --------->   ConfigurationClassPostProcessor(实现类)

      --------->BeanDefinitionRegistryPostProcessor(接口)

         --------->BeanFactoryPostProcessor(接口)

       该类负责解析处理所有@Configuration标签类,并将Bean定义注册到BeanFactory中。

  该类的来源:

    AnnotationConfigApplicationContext类
    1、AnnotationConfigApplicationContext annotationConfigApplicationContext=new AnnotationConfigApplicationContext(ConfigAOP.class);
      2、this();
        3、this.reader = new AnnotatedBeanDefinitionReader(this);
     AnnotatedBeanDefinitionReader类:
          4、this(registry, getOrCreateEnvironment(registry));
            5、AnnotationConfigUtils.registerAnnotationConfigProcessors(this.registry);
     AnnotationConfigUtils类:
              6、registerAnnotationConfigProcessors(registry, null);

猜你喜欢

转载自www.cnblogs.com/yaohuiqin/p/10523471.html