Recall & Review
beginner
What is the purpose of environment-based profiles in Spring Boot?
Environment-based profiles allow you to define different configurations for different environments, like development, testing, and production. This helps your app behave correctly depending on where it runs.
Click to reveal answer
beginner
How do you activate a specific profile in Spring Boot?
You can activate a profile by setting the
spring.profiles.active property. For example, in application.properties or as a command line argument: --spring.profiles.active=dev.Click to reveal answer
beginner
What file naming convention does Spring Boot use for profile-specific properties?
Spring Boot uses
application-{profile}.properties or application-{profile}.yml. For example, application-dev.properties for the 'dev' profile.Click to reveal answer
intermediate
Can you have multiple active profiles at the same time in Spring Boot?
Yes, you can activate multiple profiles by separating them with commas, like
spring.profiles.active=dev,debug. Spring will load configurations from all active profiles.Click to reveal answer
intermediate
How does Spring Boot decide which profile-specific properties to use when multiple profiles are active?
Spring Boot loads properties in order. The last profile in the list has higher priority and can override earlier profiles. This lets you combine and override settings as needed.
Click to reveal answer
Which property activates a Spring Boot profile?
✗ Incorrect
The correct property to activate profiles is
spring.profiles.active.What is the correct filename for properties used only in the 'test' profile?
✗ Incorrect
Profile-specific files follow the pattern
application-{profile}.properties, so application-test.properties is correct.If you activate profiles 'dev' and 'prod' together, which profile's properties take precedence?
✗ Incorrect
The last profile listed in
spring.profiles.active has higher priority and overrides earlier ones.How can you activate a profile when running a Spring Boot app from the command line?
✗ Incorrect
You activate a profile on the command line with
--spring.profiles.active=profileName.Why use environment-based profiles in Spring Boot?
✗ Incorrect
Profiles let you run different configurations or code depending on the environment, like dev or production.
Explain how Spring Boot uses environment-based profiles to manage different configurations.
Think about how you might want your app to behave differently in development vs production.
You got /4 concepts.
Describe how to activate multiple profiles and how Spring Boot resolves conflicts between them.
Consider the priority when two profiles set the same property.
You got /3 concepts.