What is the difference between putting a property on application.yml or bootstrap.yml in spring boot?

Rys picture Rys · Oct 7, 2015 · Viewed 101.5k times · Source

What is the difference between putting a property on application.yml or bootstrap.yml in spring boot? In logging.config case, the application works different.

Answer

Michael Isvy picture Michael Isvy · Feb 22, 2016

I have just asked the Spring Cloud guys and thought I should share the info I have here.

bootstrap.yml is loaded before application.yml.

It is typically used for the following:

  • when using Spring Cloud Config Server, you should specify spring.application.name and spring.cloud.config.server.git.uri inside bootstrap.yml
  • some encryption/decryption information

Technically, bootstrap.yml is loaded by a parent Spring ApplicationContext. That parent ApplicationContext is loaded before the one that uses application.yml.