liveBook · Manning

YAML

As explained in Spring in Action, Sixth Edition

YAML is a human-readable data-serialization language commonly used for hierarchical configuration.

YAML is a readable format for hierarchical configuration. In Spring Boot, application.yml can express the same settings as application.properties while making nested structure easier to scan. section 3.1.2

Configure an embedded database

Rename application.properties to application.yml and configure the H2 database with nested keys. Disabling generated names and setting the name to tacocloud produces the JDBC URL jdbc:h2:mem:tacocloud. section 3.1.2

spring:
  datasource:
    generate-unique-name: false
    name: tacocloud

This listing shows how YAML indentation groups datasource settings beneath the spring configuration key. section 3.1.2

The configuration choice has two practical implications:

  • Spring Boot accepts either properties-file format or YAML format. section 3.1.2
  • YAML is used for subsequent configuration because its structure improves readability. section 3.1.2

How Spring in Action, Sixth Edition covers it

How deep it goes
Demonstrates one nested configuration example and contrasts YAML with properties format without detailing YAML syntax broadly.
Examples
Uses application.yml to set spring.datasource.generate-unique-name and spring.datasource.name for an H2 database.
What you can do after
Operate/configure a Spring Boot application with readable YAML datasource settings.
How it connects
Connects YAML with Spring Boot, application.properties, configuration properties, H2, and JDBC URLs.

Also explained in

Compare how 16 books explain YAML →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Spring in Action, Sixth Edition. The section links point to the parts of the book it draws on.