Challenge - 5 Problems
Spring Boot Configuration Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate2:00remaining
Understanding Spring Boot Configuration Precedence
In Spring Boot, multiple configuration sources can define the same property. Which source has the highest priority when resolving the value of a property?
Attempts:
2 left
💡 Hint
Think about how you might override a property quickly when running your app.
✗ Incorrect
Spring Boot resolves properties by checking sources in a specific order. Command line arguments have the highest priority, allowing quick overrides without changing files.
❓ component_behavior
intermediate2:00remaining
Property Value Resolution in Spring Boot
Given the following property sources, which value will Spring Boot use for the property
- application.properties file:
- Environment variable:
- Command line argument:
server.port when the application starts?- application.properties file:
server.port=8080- Environment variable:
SERVER_PORT=9090- Command line argument:
--server.port=7070Attempts:
2 left
💡 Hint
Remember which source overrides others in Spring Boot.
✗ Incorrect
Command line arguments override environment variables and property files, so 7070 is used.
📝 Syntax
advanced2:00remaining
Identifying Configuration Source Priority Error
Which of the following Spring Boot property source declarations will cause the
application.properties file to be ignored, making environment variables take precedence?Attempts:
2 left
💡 Hint
Consider what happens if Spring Boot cannot find the config file location.
✗ Incorrect
If spring.config.location points to a missing directory, Spring Boot skips loading application.properties from default locations, so environment variables take precedence.
❓ state_output
advanced2:00remaining
Resulting Property Value with Multiple Sources
Consider a Spring Boot app with these property sources:
-
-
- Environment variable:
- Command line argument:
If the app is started with the profile
-
application.properties: app.mode=dev-
application-dev.properties: app.mode=development- Environment variable:
APP_MODE=production- Command line argument:
--app.mode=stagingIf the app is started with the profile
dev, what is the final value of app.mode?Attempts:
2 left
💡 Hint
Profile-specific properties are overridden by command line arguments.
✗ Incorrect
Command line arguments have the highest priority, so staging is the final value regardless of profile.
🔧 Debug
expert3:00remaining
Debugging Unexpected Property Value in Spring Boot
A developer sets
Choose the correct explanation.
spring.config.additional-location to a directory containing application.properties with feature.enabled=false. The default application.properties in src/main/resources has feature.enabled=true. The app always uses false for feature.enabled. Why?Choose the correct explanation.
Attempts:
2 left
💡 Hint
Check how additional locations affect property precedence.
✗ Incorrect
Properties in spring.config.additional-location override those in default locations, so feature.enabled=false takes precedence.