I got a spring cloud server for my applications, serving the common property files at startup.
The 'normal' functionality is working fine. An application fetches the hierarchy of files and got the full access to the loaded parameters.
Application.properties
Application-<profile>.properties
<applicationname>.properties
...
Now the question: How can I load a configuration file beside the common naming?
If I am storing another file in repositoy e.g. sharedCommonServers.properties, how can I load this file in addition using the config server? This file contains properties used by some but not all programs.
Thank you in advance!
Hendrik
Ok, at least I found a solution:
I took the normal application-context of cloud config. Within this context I placed my file sharedCommonServers.properties as a default application property file with a special profile.
Renaming:
'sharedCommonServers.properties' to 'application-commonServers.properties'
By extending the profile settings with 'commonServers' spring cloud config is fetching it in addition.
Take care there are no overlapping property-keys in the other profile-line.
So in my environment when I set...
-Dspring.profiles.active=prod,commonServers'
...I get my default prod configuration and those marked as 'commonServers' profiles.
application.properties
application-prod.properties
application-commonServers.properties // the additional one
<appname>.properties
<appname>-prod.properties
// and <appname>-commonServers.properties if I would need it
Thank you for your suggestions and thoughts!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With