Bird
0
0

Given these files:

medium📝 component behavior Q13 of 15
Spring Boot - Application Configuration
Given these files:
application.properties contains server.port=8080
application-prod.properties contains server.port=9090
And the active profile is set to prod, what port will the Spring Boot app run on?
A8080
B9090
CBoth 8080 and 9090
DNo port will be set
Step-by-Step Solution
Solution:
  1. Step 1: Understand profile override behavior

    Properties in profile-specific files override those in the default application.properties when the profile is active.
  2. Step 2: Apply active profile 'prod'

    Since 'prod' is active, server.port=9090 from application-prod.properties overrides 8080.
  3. Final Answer:

    9090 -> Option B
  4. Quick Check:

    Active profile properties override default [OK]
Quick Trick: Active profile settings override defaults [OK]
Common Mistakes:
  • Assuming default always applies
  • Thinking both ports run simultaneously
  • Ignoring profile activation

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes