1. bootstrap.yml
配置文件
在 SpringCloud
的项目中,我们常常会碰到另外一个配置文件 bootstrap.yml
。这个配置文件主要是用于应用程序上下文的引导阶段,该配置文件的加载是在 application.yml
之前。
bootstrap.yml
和application.yml
文件的区别可参考:What is the difference between putting a property on application.yml or bootstrap.yml in spring boot
在SpringCloud
中有两种上下文,一种是bootstrap
,另外一种是application
, bootstrap
是应用程序的父上下文。官方的原话是A Spring Cloud application operates by creating a “bootstrap” context, which is a parent context for the mai