Bird
0
0

You want to have a default database URL but override it only for 'test' and 'prod' profiles. How should you organize your properties files?

hard📝 Application Q8 of 15
Spring Boot - Application Configuration
You want to have a default database URL but override it only for 'test' and 'prod' profiles. How should you organize your properties files?
APut all URLs in application.properties and activate profiles to select one
BPut default URL in application.properties, override in application-test.properties and application-prod.properties
CPut URLs only in profile files, no default needed
DUse environment variables instead of properties files
Step-by-Step Solution
Solution:
  1. Step 1: Understand default and profile overrides

    Default properties go in application.properties; profile files override selectively.
  2. Step 2: Apply to database URL

    Put default URL in application.properties, override in application-test.properties and application-prod.properties.
  3. Final Answer:

    Put default URL in application.properties, override in application-test.properties and application-prod.properties -> Option B
  4. Quick Check:

    Default in main file, overrides in profile files [OK]
Quick Trick: Default config in main file, overrides in profile files [OK]
Common Mistakes:
  • Putting all URLs only in default file
  • Skipping default URL entirely
  • Using environment variables instead of properties

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes