YAML for properties

Spring Boot supports YAML for properties as an alternative to properties files. YAML is convenient for hierarchical configuration data. Spring Boot properties are organized in groups, for example, server, database, and so on.

Let's see the following properties:

  • In application.properties:
database.host = localhost 
database.user = admin
  • In application.yml:
database:  
   host: localhost 
   user: admin 

Let's see, in the following section, how to define multiple profiles in a single YAML file.

Get Mastering Spring Boot 2.0 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.