Bird
0
0

A developer excludes the default embedded Tomcat and adds Jetty dependency in a Spring Boot app, but the app still starts with Tomcat. What is the most probable cause?

medium📝 Debug Q7 of 15
Spring Boot - Fundamentals
A developer excludes the default embedded Tomcat and adds Jetty dependency in a Spring Boot app, but the app still starts with Tomcat. What is the most probable cause?
AThe Tomcat starter dependency was not fully excluded, causing it to remain on the classpath
BJetty is not supported as an embedded server in Spring Boot
CThe application.properties file forces Tomcat usage explicitly
DSpring Boot always prefers Tomcat regardless of dependencies
Step-by-Step Solution
Solution:
  1. Step 1: Understand dependency management

    Spring Boot includes Tomcat by default via starter-web dependency.
  2. Step 2: Effect of excluding Tomcat

    If Tomcat is not properly excluded, it remains on the classpath and starts.
  3. Step 3: Jetty support

    Jetty is supported but requires Tomcat exclusion to take effect.
  4. Final Answer:

    The Tomcat starter dependency was not fully excluded, causing it to remain on the classpath -> Option A
  5. Quick Check:

    Incomplete exclusion keeps Tomcat active [OK]
Quick Trick: Exclude Tomcat fully to switch embedded server [OK]
Common Mistakes:
  • Assuming Jetty is unsupported
  • Forgetting to exclude Tomcat starter
  • Believing Spring Boot ignores dependencies

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes