Challenge - 5 Problems
Spring Boot Properties Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate2:00remaining
Understanding property key-value pairs in application.properties
Which of the following lines correctly defines a property in
application.properties to set the server port to 8080?Attempts:
2 left
💡 Hint
Look for the standard syntax using dot notation and equals sign.
✗ Incorrect
In application.properties, properties are defined as key-value pairs separated by an equals sign. The key uses dot notation for hierarchy. So server.port=8080 is correct.
❓ component_behavior
intermediate2:00remaining
Effect of duplicate keys in application.properties
If
What will be the effective value of
application.properties contains these two lines:spring.datasource.url=jdbc:mysql://localhost:3306/db1spring.datasource.url=jdbc:mysql://localhost:3306/db2What will be the effective value of
spring.datasource.url when the application runs?Attempts:
2 left
💡 Hint
Think about which value overrides the other in properties files.
✗ Incorrect
When duplicate keys exist, the last occurrence overrides previous ones. So the effective value is the second line's URL.
📝 Syntax
advanced2:00remaining
Correct syntax for multiline values in application.properties
Which option correctly defines a multiline property value in
application.properties?Attempts:
2 left
💡 Hint
Escape sequences are used for new lines inside values.
✗ Incorrect
To represent new lines inside a property value, use the escape sequence \n. So option C is correct. Actual new lines in the file break the syntax.
🔧 Debug
advanced2:00remaining
Identify the error in this application.properties snippet
Given this snippet:
What error will Spring Boot raise when loading this configuration?
server.port=8080
spring.datasource.username=root
spring.datasource.passwordWhat error will Spring Boot raise when loading this configuration?
Attempts:
2 left
💡 Hint
In properties files, a line with just a key sets an empty value.
✗ Incorrect
No error occurs; the property spring.datasource.password is loaded with an empty string value since no separator is found.
❓ state_output
expert2:00remaining
Number of properties loaded from this application.properties
Consider this
How many unique properties will Spring Boot load?
application.properties content:app.name=TestApp app.version=1.0 app.description=Sample app app.name=ProdApp app.debug=true
How many unique properties will Spring Boot load?
Attempts:
2 left
💡 Hint
Remember that duplicate keys overwrite previous ones.
✗ Incorrect
There are 5 lines but app.name appears twice. The last value overwrites the first, so 4 unique properties are loaded.