Bird
0
0

How can you implement a feature flag in Spring Boot that supports dynamic updates without restarting the application?

hard📝 Application Q9 of 15
Spring Boot - Advanced Patterns
How can you implement a feature flag in Spring Boot that supports dynamic updates without restarting the application?
AStore the feature flag in a static final variable
BUse Spring Cloud Config with a refresh scope bean for the feature flag
CHardcode the feature flag value in the source code
DUse a constant in application.properties without refresh
Step-by-Step Solution
Solution:
  1. Step 1: Identify dynamic config options

    Spring Cloud Config supports external config with refresh scope for dynamic updates.
  2. Step 2: Match to options

    Use Spring Cloud Config with a refresh scope bean for the feature flag uses Spring Cloud Config and refresh scope, enabling runtime updates without restart.
  3. Final Answer:

    Use Spring Cloud Config with a refresh scope bean for the feature flag -> Option B
  4. Quick Check:

    Refresh scope enables dynamic config updates [OK]
Quick Trick: Use refresh scope beans for dynamic feature flags [OK]
Common Mistakes:
  • Using static final variables which are immutable
  • Hardcoding flags preventing runtime changes
  • Ignoring config refresh mechanisms

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes