Skip to content
Ameen Abozaid
Planned lessonJNR-012-L01

application.yml and profiles

  • Lesson 1 of 5
  • Junior
On This Lesson 4 topics

This lesson is planned. The outline below lists the topics it will cover. The full lesson has not been published yet.

In this lesson

configure the app with YAML and switch profiles.

Planned topics

  • application.yml holds settings in a readable tree; .properties says the same in flat form.
  • A profile is a named set of settings, such as dev or prod.
  • Profile files: application-dev.yml, application-prod.yml; they add to or override the base file.
  • Activate with spring.profiles.active=dev or the environment variable SPRING_PROFILES_ACTIVE.
Draft outline details

Demonstration

yaml
# application.yml
shop:
  currency: EUR
---
# application-dev.yml
shop:
  currency: USD

Check your understanding

How do you choose the prod profile without editing files?

Show answer

Set SPRING_PROFILES_ACTIVE=prod.

Practice

Apply this lesson with the module's lab, exercises and quiz.

Lab and exercises Quiz

Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.

Continue to next lesson

Type to search levels, phases, modules and lessons.