Challenge - 5 Problems
Spring Boot Configuration Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ component_behavior
intermediate2:00remaining
How does Spring Boot use configuration files?
Consider a Spring Boot application with an
application.properties file setting server.port=8081. What happens when you run the app?Attempts:
2 left
💡 Hint
Spring Boot reads configuration files to set properties like ports.
✗ Incorrect
Spring Boot reads application.properties at startup and applies settings like server.port. This changes the port the app listens on.
❓ state_output
intermediate2:00remaining
What is the value of a bean property from configuration?
Given a Spring Boot bean with
@Value("${app.name}") and app.name=MyApp in application.properties, what is the value of the bean's property after startup?Attempts:
2 left
💡 Hint
Spring Boot replaces placeholders with values from configuration files.
✗ Incorrect
The @Value annotation injects the value from the configuration file. So the property becomes "MyApp".
📝 Syntax
advanced2:00remaining
Which configuration syntax correctly sets a list property in Spring Boot YAML?
You want to set a list of servers in
application.yml. Which option is correct?Attempts:
2 left
💡 Hint
YAML uses dashes for list items.
✗ Incorrect
In YAML, lists are defined with dashes before each item. Option B uses this correct syntax.
🔧 Debug
advanced2:00remaining
Why does this Spring Boot app fail to load configuration?
Given
application.properties with myapp.timeout=30 and a bean with @Value("${myapp.timeout}") private int timeout;, the app throws a NumberFormatException. Why?Attempts:
2 left
💡 Hint
Check the exact value in the properties file for hidden characters.
✗ Incorrect
If the property value has spaces or non-numeric characters, Spring Boot cannot convert it to int, causing NumberFormatException.
🧠 Conceptual
expert2:00remaining
Why is externalized configuration important in Spring Boot?
Which best explains why externalized configuration matters in Spring Boot applications?
Attempts:
2 left
💡 Hint
Think about how apps run in different places like development, testing, and production.
✗ Incorrect
Externalized configuration lets you adjust settings like database URLs or ports without changing code, making apps flexible and easier to manage.