Bird
0
0

Consider a Spring Boot application with two profiles: dev and prod. If both profiles are activated simultaneously, which of the following is true about property resolution?

medium📝 component behavior Q5 of 15
Spring Boot - Docker and Deployment

Consider a Spring Boot application with two profiles: dev and prod. If both profiles are activated simultaneously, which of the following is true about property resolution?

AProperties from both profiles merge without conflicts
BOnly the first activated profile's properties are used
CApplication throws an error due to multiple profiles
DProperties from the last activated profile override earlier ones
Step-by-Step Solution
Solution:
  1. Step 1: Understand multiple active profiles behavior

    When multiple profiles are active, Spring Boot loads properties in order and later ones override earlier ones.
  2. Step 2: Identify how conflicts are resolved

    Properties from the last profile in the list override previous ones if keys conflict.
  3. Final Answer:

    Properties from the last activated profile override earlier ones -> Option D
  4. Quick Check:

    Last profile wins on conflicts [OK]
Quick Trick: Last active profile properties override earlier ones [OK]
Common Mistakes:
  • Assuming properties merge without override
  • Expecting error on multiple profiles
  • Thinking only first profile applies

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes