I am confused: Sometimes I see application.properties, sometimes application.yml.
In the official services documentation I read about a application.properties file, see [here]<INTERNAL_LINK>. But in the server that got installed via the installer on my disk, I see a application.yml file - and I can’t find the application.properties file… Some of the fields and entries look very similar (same?) though.
- Are they same / different?
- Is one overwriting the other?
- Is there a way to reliably find out what configuration is used?
- When should I use one or the other?
- Why do we have 2 different formats?
Thx a lot, Till.
Spring allows you to use various different ways how to configure your applications. We are using spring approach which is currently de facto standard. We have a complicated system of configuration resolution so that we would have well-documented default behavior which can be overwritten by the configuration provided by client project
- by extending services
- by providing configuration during runtime (start-up)
Our default configuration is defined by configuration in autoconfigure modules to keep our configuration separated from our code (this way the client projects can change the configuration without a need of recompiling our modules) and it is documented in our documentation.
We need to configure some our modules so we use spring configuration options with properties or yaml files. These files are not the files you need to change in any way. If you wish to run server with a different configuration than a default one please follow the instructions here: 24. Externalized Configuration
You can change just one property, or mutiple or you can even provide more configuration files that overwrite each other.