0
0
Spring Bootframework~20 mins

Application.properties basics in Spring Boot - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Application.properties Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
component_behavior
intermediate
2:00remaining
What is the effect of this application.properties setting?
Given the following line in application.properties:

server.port=8081

What will be the port number your Spring Boot application listens on?
AThe application listens on port 8080 (default).
BThe application listens on port 8081.
CThe application listens on port 80.
DThe application will fail to start due to invalid port.
Attempts:
2 left
💡 Hint
The server.port property controls the HTTP port.
📝 Syntax
intermediate
2:00remaining
Which line correctly sets a custom application name in application.properties?
You want to set the application name to "MyApp" using application.properties. Which option is correct?
Aspring.application.name=MyApp
Bspring.application.name: MyApp
Cspring.application.name = "MyApp"
Dspring.application.name => MyApp
Attempts:
2 left
💡 Hint
Properties files use key=value format without quotes.
🔧 Debug
advanced
2:00remaining
What error occurs with this application.properties line?
Consider this line in application.properties:

spring.datasource.url jdbc:mysql://localhost:3306/db

What happens when Spring Boot tries to start?
ASpring Boot throws a <code>java.lang.IllegalArgumentException</code> due to invalid property syntax.
BSpring Boot starts normally and connects to the database.
CSpring Boot throws a <code>BeanCreationException</code> due to missing URL.
DSpring Boot ignores the line and uses default datasource URL.
Attempts:
2 left
💡 Hint
Check the syntax for key-value pairs in properties files.
state_output
advanced
2:00remaining
What is the value of logging.level.root after loading this application.properties?
Given these lines in application.properties:

logging.level.root=INFO
logging.level.org.springframework=DEBUG

What is the effective logging level for the root logger?
AINFO
BDEBUG
CWARN
DERROR
Attempts:
2 left
💡 Hint
Specific package levels override root, but root applies globally.
🧠 Conceptual
expert
2:00remaining
Which statement about application.properties loading order is true?
In Spring Boot, which of these statements about application.properties loading order is correct?
AProperties in <code>src/main/resources/application.properties</code> override those in external config files.
BThe order of properties loading is random and unpredictable.
CProperties defined in <code>application.properties</code> are always overridden by environment variables.
DExternal configuration files have higher priority than packaged <code>application.properties</code>.
Attempts:
2 left
💡 Hint
Think about how Spring Boot prioritizes external vs internal config.