Spring Boot Default support properties(.properties) and YAML(.yml .yaml ) Two formats of profiles ,yml and
properties Files belong to configuration files , Function is the same .

Spring Cloud Build on Spring Boot Above , stay Spring Boot There are two contexts in , One is bootstrap, The other is
application, Here are the differences between the two profiles

<> Loading order

if application.yml and bootstrap.yml In the same directory :bootstrap.yml Load first application.yml Post loading

bootstrap.yml Boot phase for application context .bootstrap.yml By father Spring ApplicationContext Load .

<> Configuration difference

bootstrap.yml and application.yml Can be used to configure parameters .

bootstrap.yml
Used to execute when the program is booted , Apply to earlier configuration information reading . It can be understood as some parameter configuration at system level , Generally, these parameters will not change . once bootStrap.yml
Be loaded , Content will not be overwritten .

application.yml Can be used to define application level , Application specific configuration information , It can be used to configure common parameters to be used in subsequent modules .

<> Property override problem

When starting context ,Spring Cloud Will create a Bootstrap Context, Act as Spring Applied Application Context
Parent context of .

When initializing ,Bootstrap Context Responsible for loading configuration properties from external sources and parsing configuration . The two contexts share an external Environment.
Bootstrap Property has high priority , By default , They will not be overwritten by the local configuration .

That is to say, if the application.yml Content labels and bootstrap Consistent labels for ,application It won't cover bootstrap, and
application.yml The contents can be replaced dynamically .

<>bootstrap.yml Typical application scenarios

* When used Spring Cloud Config Server When configuring the center , You need to bootstrap.yml Specified in the configuration file
spring.application.name and
spring.cloud.config.server.git.uri, Add configuration properties connected to configuration center to load configuration information of external configuration center
* Some fixed properties that cannot be overwritten
* Some encryption / Decryption scenario

Technology
©2019-2020 Toolsou All rights reserved,
Huawei 2021 session Hardware Engineer Logical post (FPGA) Super detailed surface !!!Vue-element-admin upgrade ui edition virtual machine VMware Download and install the most detailed tutorial !C++ Move constructor and copy constructor sound of dripping water java Backstage interview pygame Realize full screen mode and adjustable window size mysql Database setting character set configuration modification my.ini file (windows)30 What's the experience of being a junior programmer at the age of 20 C++ Multithreading programming ( Summary of common functions and parameters )python_ cherry tree