单纯做
Spring Boot
开发,可能不太容易遇到
bootstrap.properties
配置文件,但是在结合
Spring Cloud
时,这个配置就会经常遇到了,特别是在需要加载一些远程配置文件的时侯。
spring boot
核心的两个配置文件:
bootstrap (. yml
或者
. properties)
:
boostrap
由父
ApplicationContext
加载的,比
applicaton
优先加载,配置在应用程序上下文的引导阶段生效。一般来说我们在
Spring
Cloud
配置就会使用这个文件。且
boostrap
里面的属性不能被覆盖;
application (. yml
或者
. properties)
: 由
ApplicatonContext
加载,用于
spring boot
项目
的自动化配置。