Core configuration file

Spring Boot project in the core profile

  • application (.properties 或 .yml)
  • bootstrap (.properties 或 .yml)

Difference bootstrap / application of

characteristic

  Spring Cloud Spring Boot built on, there are two context Spring Boot, a bootstrap is, the other is a file application, bootstrap context of the application is the parent, i.e. bootstrap loading precedence applicaton. bootstrap mainly used from additional resources to load the configuration information, you can decrypt the property outside the local configuration file. Both share an environment context, it is the source of any external properties Spring application. Inside the priority attribute bootstrap loading, default they can not be covered with the same configuration locally. 

  In short, in contrast to the application configuration file,

  • boostrap loaded by the parent ApplicationContext, loading priority than the applicaton
  • boostrap inside can not be overwritten

Scenarios

  application configuration file is mainly used for automated configuration Spring Boot project.

  bootstrap configuration file has the following scenarios:

  • When using Spring Cloud Config distribution center, then you need to add a connection configuration properties of the configuration center to load the configuration information in the external configuration of the central bootstrap configuration file;
  • Some fixed attributes can not be covered
  • Some encryption / decryption of the scene;

Guess you like

Origin www.cnblogs.com/517cn/p/10943636.html