引言
SpringBoot是当今Java开发中最受欢迎的微服务框架之一,其简化了Java应用的开发和部署过程。了解SpringBoot的启动流程对于深入理解其原理和内部机制至关重要。本文将深入分析SpringBoot的启动过程,探讨其中的关键步骤和机制,后基于这些机制,我们尝试做一些扩展和一些个性化内容。
启动流程分析
流程图

源代码
// org.springframework.boot.SpringApplication
public class SpringApplication {
public SpringApplication(ResourceLoader resourceLoader, Class<?>... primarySources) {
this.resourceLoader = resourceLoader;
Assert.notNull(primarySources, "PrimarySources must not be null");
this.primarySources = new LinkedHashSet<>(Arrays.asList(primarySources));
this.webApplicationType = WebApplicationType.deduceFromClasspath();
this.bootstrapRegistryInitializers = new ArrayList<>(
getSpringFactoriesInstances(BootstrapRegistryInitializer.class));
setInitializers((Collection) getSpringFactoriesInstances(ApplicationContextInitializer.class));

最低0.47元/天 解锁文章
5649

被折叠的 条评论
为什么被折叠?



