Bird
0
0

Given the following Spring Boot configuration sources:

medium📝 component behavior Q13 of 15
Spring Boot - Application Configuration
Given the following Spring Boot configuration sources:
application.properties sets server.port=8080
Environment variable SERVER_PORT=9090
Command line argument --server.port=7070
What port will the application run on?
A7070
B9090
CDefault port 8081
D8080
Step-by-Step Solution
Solution:
  1. Step 1: List configuration sources and their values

    application.properties: 8080, environment variable: 9090, command line argument: 7070.
  2. Step 2: Apply Spring Boot precedence order

    Command line arguments override environment variables and properties files, so port is 7070.
  3. Final Answer:

    7070 -> Option A
  4. Quick Check:

    Command line args override others = 7070 [OK]
Quick Trick: Command line args always win over env and properties [OK]
Common Mistakes:
  • Choosing environment variable value instead of command line
  • Assuming properties file overrides environment variables
  • Forgetting default port fallback

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes