A Quick Comparison of YAML with Properties File

YAML is a human friendly data serialization standard, which is mainly made for configuration files. YAML stands for YAML Ain't Markup Language. YAML can be used with many programming languages.

YAML supports Maps, lists and scalar types. YAML is hierarchical and may use consistent spaces to denote hierarchy. It will also support inline maps. YAML also supports multiple Spring profiles in single YAML config file. One limitation of YAML however is that it does not work with @PropertySource annotation. Read more @ http://yaml.org/.



  key: k

  value: 9

map2: {b=true, date=2016-10-10}

Properties file is mainly used with Java, supports only String types and is non-hierarchical; we can have maps by denoting hierarchies as dots. Properties file will also work with @PropertySource annotation. One of the limitation of properties file is that we can only configure one Spring profile per properties file.





Lists may be represented using the array syntax or as inline list (separated by commas) in a properties file:

myList1[0] = one

myList1[1] = two

 myList2 = one, two


Lists are represented hierarchically or as inline list in YAML:


  - one

  - two

myList2: [one, two]


Properties files have “. properties” extension, whereas a YAML has a “. yml” or “. yaml” extension.


Comment syntaxes are same in both:

# this is a comment

Search the Web

Custom Search

Searches whole web. Use the search in the right sidebar to search only within javajee.com!!!