Spring Boot Tutorial 0/110 lessons ~6 min read Lesson 11
application.properties & YAML
application.properties and application.yml are interchangeable formats for Spring Boot configuration.
Course progress0%
Focus
4 guided sections
Practice signal
Examples included
Career prep
Foundation builder
Introduction
application.properties and application.yml are interchangeable formats for Spring Boot configuration. YAML is preferred in modern projects: nested, less repetition, supports lists.
Syntax reference
bash
# application.yml — same thing, nestedserver:port: 8080spring:datasource:url: jdbc:postgresql://localhost:5432/ordersjpa:hibernate:ddl-auto: validatelogging:level:com.acme: DEBUG
Informative example
The same config in both formats:
bash
# application.propertiesserver.port=8080spring.datasource.url=jdbc:postgresql://localhost:5432/ordersspring.jpa.hibernate.ddl-auto=validatelogging.level.com.acme=DEBUG
Best practices
- Pick one format per project; mixing causes confusion.
- Per-env overrides:
application-prod.ymlactivated bySPRING_PROFILES_ACTIVE=prod. - Reference env vars:
password: ${DB_PASSWORD}.
Ready to mark this lesson complete?Track your journey across the entire course.