SpringBoot-自动配置流程


@SpringBootApplication
	@EnableAutoConfiguration
	    @AutoConfigurationPackage
	    @Import(AutoConfigurationImportSelector.class implements DeferredImportSelector) 
	        getImportGroup(): AutoConfigurationGroup implements DeferredImportSelector.Group
	            process()
	                getAutoConfigurationEntry()  ->  ImportCandidates.load  ->   META-INF/spring/%s.imports
	                getConfigurationClassFilter()  ->  AutoConfigurationMetadataLoader.loadMetadata  ->  META-INF/spring-autoconfigure-metadata.properties
	                fireAutoConfigurationImportEvents()   ->  SpringFactoriesLoader.loadFactories  ->   META-INF/spring.factories
	            selectImports()  ->  sortAutoConfigurations()   ->  @AutoConfigureOrder & @AutoConfigureBefore & @AutoConfigureAfter
	@ComponentScan ->  excludeFilters
	    AutoConfigurationExcludeFilter ->  isAutoConfiguration()  ->   META-INF/spring.factories
        TypeExcludeFilter   ->   ApplicationContextInitialize  ->   META-INF/spring.factories

SpringBoot 自动配置流程


文章作者: 钱不寒
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 钱不寒 !
  目录