Search code examples
javaspring-bootspring-cloud

How can I make a profile-specific bootstrap.yml?


I want to have different property values in a bootstrap.yml file depending on a spring profile passed to a starting application (the same way as it works for application-{profile-name}.yml).

How is it possible?


Solution

  • According to the documentation it should work pretty much the same.

    Changing the Location of Bootstrap Properties:

    If there is an active profile (from spring.profiles.active or through the Environment API in the context you are building), properties in that profile get loaded as well, the same as in a regular Spring Boot app — for example, from bootstrap-development.properties for a development profile.

    That is it should be possible to suffix the bootstrap yaml with the environment name to make it take effect.