Spring Boot的启动加载顺序是一个涉及多个步骤和组件的过程。以下是按照主要阶段和关键步骤划分的Spring Boot启动加载顺序的概述:
org.springframework.boot.SpringApplication
。SpringApplication
实例时,进行一系列的初始化工作,包括: SpringFactoriesLoader
加载ApplicationContextInitializer
和ApplicationListener
。application.properties
或application.yml
格式。file:./config/
(项目根路径下的config文件夹)file:./
(项目根路径)classpath:/config/
(类路径下的config文件夹)classpath:/
(类路径)spring.config.location
:用于指定配置文件的新位置。META-INF/spring.factories
配置文件中加载的)。META-INF/spring.factories
配置文件中加载的)。CommandLineRunner
执行。application-dev.yml
)通常具有比不带profile的配置文件(如application.yml
)更高的优先级。通过清晰地了解Spring Boot的启动加载顺序,可以更好地理解和控制应用的启动过程,以及如何进行配置和扩展。
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有