0
0
Spring Bootframework~5 mins

Environment-based profiles in Spring Boot - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
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?
Aspring.profile.enable
Bspring.profiles.active
Cspring.environment.profile
Dspring.boot.profile
What is the correct filename for properties used only in the 'test' profile?
Aapplication-test.properties
Bapplication.properties.test
Ctest-application.properties
Dapplication.properties
If you activate profiles 'dev' and 'prod' together, which profile's properties take precedence?
Aprod
Bdev
CBoth have equal priority
DDepends on alphabetical order
How can you activate a profile when running a Spring Boot app from the command line?
A--spring.profile=profileName
B--activate.profile=profileName
C--profile.active=profileName
D--spring.profiles.active=profileName
Why use environment-based profiles in Spring Boot?
ATo store all settings in one file
BTo avoid using properties files
CTo run different code depending on environment
DTo disable configuration
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.