1. Concept library
  2. Java & Spring Boot
  3. Module 13: Observability and deployment

Concept

Configuration per environment

The same image runs in development, staging and production with different configuration supplied from outside: environment variables, profiles and mounted secrets. Nothing environment-specific is baked into the build.

What a session covers

The tutor works through these with you, in conversation and code. A session ends when you have shown them, not when a video does.

  1. Explain why environment-specific values stay out of the build
  2. Supply configuration from environment variables and profiles
  3. Spot the secret committed in a profile file

In practice

A few lines that show Configuration per environment doing its job.

YAML
# application.yml: defaults
spring:
  datasource:
    url: ${DATABASE_URL:jdbc:postgresql://localhost:5432/app}
---
# application-prod.yml: activated with SPRING_PROFILES_ACTIVE=prod
spring:
  config:
    activate:
      on-profile: prod
  jpa:
    hibernate:
      ddl-auto: validate

The common mistake

Watch for

Committing secrets in application-prod.yml. Credentials belong in the environment or a secret manager; the file should reference them with placeholders only.

What to know first

Your roadmap puts these before Configuration per environment, unless you already know them.

How it stays learned

Once a session shows you understand Configuration per environment, it comes back for review. Each review takes a minute and tells the memory model how well you still know it.

  1. Day 3First recall, while it is fresh
  2. Day 7Second, a week on
  3. Day 18Last, when it has settled
Previous in the module← Containerising with Docker