You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Application- and profile-specific configuration usage - undocumented or not meant to be used? #1868
We are currently using a feature of the Spring Cloud Config server that I find quite neat, which is using an application- and profile-specific .yml file on the Config server side that is named ${spring.application.name}-<profile>.yml.
endpoint. This feature allows some very nice configuration setups (e.g. separate DataSource properties for separate applications, neatly separated from each other). So, for example:
config/
application.yml # Standard properties
application-${profile}.yml # Profile relevant settings
book-service.yml # Standard properties for "book-service" only
book-service-${profile}.yml # Profile-specific settings for "book-service" only
However, I cannot find any documentation for this feature. Seeing how the endpoint exists, I am assuming that it was meant to be used. Is this a documentation oversight (which I can gladly make a PR for), or was there an intention to deprecate this endpoint at some time?
I needed to validate behavior to understand which one is given more preference than other. My finding is as follows:
Configurations are used in the following orders:
book-service-${profile}.yml
application-${profile}.yml
book-service.yml
application.yml
So, when the configuration property is available in book-service-${profile}.yml it's used at the top priority. If it doesn't exist there, then application-${profile}.yml is searched, and so on.
I opened #3347 with an ordered list of these files in the Environment Repository docs, and a test that pins the order: {application}-{profile} first, then application-{profile}, then {application}, then application, with the last listed profile ranking highest. That matches what @ChiragMoradiya observed above.
Activity
filpano commentedon Apr 28, 2021
According to these two:
#1856 (comment)
#1856 (comment)
comments, it seems this is a indeed a supported feature. I'll get a PR to enhance the documentation up within the next few days.
ChiragMoradiya commentedon May 23, 2021
I needed to validate behavior to understand which one is given more preference than other. My finding is as follows:
Configurations are used in the following orders:
book-service-${profile}.ymlapplication-${profile}.ymlbook-service.ymlapplication.ymlSo, when the configuration property is available in
book-service-${profile}.ymlit's used at the top priority. If it doesn't exist there, thenapplication-${profile}.ymlis searched, and so on.sharanggupta commentedon Oct 15, 2026
I opened #3347 with an ordered list of these files in the Environment Repository docs, and a test that pins the order:
{application}-{profile}first, thenapplication-{profile}, then{application}, thenapplication, with the last listed profile ranking highest. That matches what @ChiragMoradiya observed above.Document the order of application and profile specific files (spring-…