application.yml vs application.properties for Spring Boot

cupakob picture cupakob · Nov 23, 2017 · Viewed 63.3k times · Source

In my project i'm currently using application.yml for configuration. Spring Initializr generate application.properties? What are the Pro/Cons for each one?

Answer

YoungSpice picture YoungSpice · Nov 24, 2017

Well, they are just different data formats. Which one's nicer and easier to read? That's obviously subjective. Here's a useful blog post.

As far as spring-boot configuration is concerned, note that there's only one documented shortcoming of using YAML. Per the documentation:

YAML files can’t be loaded via the @PropertySource annotation. So in the case that you need to load values that way, you need to use a properties file.