From experimentation, it would appear that Spring Boot 3.x supports both application.yaml and application.yml for external configuration. However the documentation in many places refers to *.yml as the preferred extension. For example:
If you have configuration files with both
.propertiesand.ymlformat in the same location, .properties takes precedence.
And:
For example, if your application activates a profile named prod and uses YAML files, then both
application.ymlandapplication-prod.ymlwill be considered.
However in other places it refers to *.yaml:
Spring Boot will automatically find and load
application.propertiesandapplication.yamlfiles from the following locations when your application starts:
And:
To import these properties, you can add the following to your
application.propertiesorapplication.yamlfile:
Whatever the situation years ago, in 2023 the official recommended extension for YAML files is *.yaml.
- https://stackoverflow.com/a/54265316
- https://en.wikipedia.org/wiki/YAML
- https://yaml.org/faq.html
Yeah, yaml.org is stale, and yeah, some people just like .yml, but surely you agree that the documentation should be consistent. Let's stick with one thing. And as someone pointed out in a comment to a Stack Overflow question, unless you prefer .htm over .html, let's move forward together and use .yaml.
Comment From: scottfrederick
Closing in favor of #34628