Spring Boot Tutorial 0/110 lessons ~6 min read Lesson 87
Environment Variables
Twelve-factor app rule #3: store config in the environment.
Course progress0%
Focus
2 guided sections
Practice signal
Examples included
Career prep
Foundation builder
Introduction
Twelve-factor app rule #3: store config in the environment. Spring Boot maps SPRING_DATASOURCE_URL automatically to spring.datasource.url.
Informative example
bash
# Localexport SPRING_PROFILES_ACTIVE=devexport DB_PASSWORD=secret./mvnw spring-boot:run# Dockerdocker run -e SPRING_PROFILES_ACTIVE=prod -e DB_PASSWORD=${DB_PASSWORD} acme/orders# Kubernetes secret → envenv:- name: DB_PASSWORDvalueFrom: { secretKeyRef: { name: orders, key: db-password } }
Ready to mark this lesson complete?Track your journey across the entire course.