Spring source code invokeBeanFactoryPostProcessors method description (two)
1. Start
1. Look for the configuration class (org.springframework.context.annotation.ConfigurationClassPostProcessor#processConfigBeanDefinitions)
2. There is such a piece of code in checkConfigurationClassCandidate. After
reading this code, does it suddenly get something? Is it for finding the configuration class? The method is understood.
3. Key points (org.springframework.context.annotation.ConfigurationClassParser#parse)
4. doProcessConfigurationClass analysis
5. doProcessConfigurationClass–>@PropertySource annotation analysis
6. doProcessConfigurationClass–>@ComponentScan annotation analysis (focus)
parse: Creating ClassPathBeanDefinitionScanner, convert componentScan ClassPathBeanDefinitionScanner into
the following main analysis doScan in these two methods
findCandidateComponents to analyze
findCandidateComponents-> isCandidateComponent
findCandidateComponents-> registerBeanDefinition, at a glance, registered beanDefinition, registered alias
Second, the end of the
chapter analyzes the @PropertySource and @ ComponentScan source code. The next chapter will analyze the @Import source code.