Bird
0
0

If you create a Spring Boot project with Spring Initializr but omit the 'Spring Web' dependency, what problem will you encounter when running a REST controller?

medium📝 Debug Q6 of 15
Spring Boot - Fundamentals
If you create a Spring Boot project with Spring Initializr but omit the 'Spring Web' dependency, what problem will you encounter when running a REST controller?
AThe project will not build because Gradle files are missing
BThe application will fail to compile due to missing Lombok annotations
CDatabase connections will fail due to missing JPA dependencies
DNo HTTP server will start, causing 404 errors on REST endpoints
Step-by-Step Solution
Solution:
  1. Step 1: Understand the role of 'Spring Web'

    It provides embedded web server and MVC framework needed for REST controllers.
  2. Step 2: Consequence of omission

    Without it, no embedded server starts, so REST endpoints return 404 or connection refused.
  3. Step 3: Exclude other options

    Lombok and JPA are unrelated to web server startup; Gradle files depend on build tool choice.
  4. Final Answer:

    No HTTP server will start, causing 404 errors on REST endpoints -> Option D
  5. Quick Check:

    Missing Spring Web means no embedded server [OK]
Quick Trick: No Spring Web means no embedded server for REST [OK]
Common Mistakes:
  • Assuming compilation errors instead of runtime issues
  • Confusing web dependency with database dependencies
  • Thinking build files are missing

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes