Bird
0
0

Why does Spring Boot prefer the syntax ${VAR_NAME:default} over shell-style $VAR_NAME or Windows-style %VAR_NAME% in configuration files?

hard📝 Conceptual Q10 of 15
Spring Boot - Application Configuration
Why does Spring Boot prefer the syntax ${VAR_NAME:default} over shell-style $VAR_NAME or Windows-style %VAR_NAME% in configuration files?
ABecause it supports default values and consistent cross-platform parsing
BBecause $VAR_NAME is invalid in all programming languages
CBecause %VAR_NAME% is only for Windows batch scripts
DBecause Spring Boot does not support environment variables at all
Step-by-Step Solution
Solution:
  1. Step 1: Understand Spring Boot's placeholder syntax design

    Spring Boot uses ${VAR_NAME:default} to allow specifying defaults and ensure consistent parsing across OSes.
  2. Step 2: Compare with shell and Windows syntax

    Shell $VAR_NAME and Windows %VAR_NAME% are platform-specific and lack default value support.
  3. Final Answer:

    Because it supports default values and consistent cross-platform parsing -> Option A
  4. Quick Check:

    Cross-platform default support = ${VAR_NAME:default} [OK]
Quick Trick: Use ${VAR:default} for cross-platform env var support [OK]
Common Mistakes:
  • Thinking $VAR_NAME works everywhere
  • Assuming %VAR_NAME% works on Linux/Mac
  • Believing Spring Boot ignores env vars

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes