Spring source code invokeBeanFactoryPostProcessors method description (two)

Spring source code invokeBeanFactoryPostProcessors method description (two)

1. Start
1. Look for the configuration class (org.springframework.context.annotation.ConfigurationClassPostProcessor#processConfigBeanDefinitions)
Insert picture description here
2. There is such a piece of code in checkConfigurationClassCandidate. After
Insert picture description here
Insert picture description here
Insert picture description here
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)
Insert picture description here
Insert picture description here
4. doProcessConfigurationClass analysis
Insert picture description here
Insert picture description here
5. doProcessConfigurationClass–>@PropertySource annotation analysis
Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here
6. doProcessConfigurationClass–>@ComponentScan annotation analysis (focus)

Insert picture description here
parse: Creating ClassPathBeanDefinitionScanner, convert componentScan ClassPathBeanDefinitionScanner into
Insert picture description here
Insert picture description here
the following main analysis doScan in these two methods
Insert picture description here
findCandidateComponents to analyze
Insert picture description here
Insert picture description here
findCandidateComponents-> isCandidateComponent
Insert picture description here
findCandidateComponents-> registerBeanDefinition, at a glance, registered beanDefinition, registered alias
Insert picture description here
Second, the end of the
chapter analyzes the @PropertySource and @ ComponentScan source code. The next chapter will analyze the @Import source code.

Guess you like

Origin blog.csdn.net/mlplds/article/details/102807610