Card 03/ 06
All 6 cards
ExampleDifficulty: Intermediate1 min
Switching a Whole Set of Properties at Once
A profile is a named set of properties that only takes effect when you say so. application-prod.properties sits beside application.properties and contributes nothing at all until the prod profile is active.
app.greeting=hello from application.propertiesapp.greeting=hello from application-prod.properties$ java -jar app.jar
app.greeting = hello from application.properties
$ java -jar app.jar --spring.profiles.active=prod
app.greeting = hello from application-prod.propertiesOne flag, --spring.profiles.active=prod, switched every property application-prod.properties sets — not just this one. That is the actual value of a profile over setting properties individually: it groups everything a given environment needs behind one name.