Bird
0
0

You added the springdoc-openapi-starter-webmvc-ui dependency but when you run your Spring Boot app, the Swagger UI page shows a 404 error. What is the most likely cause?

medium📝 Debug Q14 of 15
Spring Boot - API Documentation
You added the springdoc-openapi-starter-webmvc-ui dependency but when you run your Spring Boot app, the Swagger UI page shows a 404 error. What is the most likely cause?
AYou are trying to access the Swagger UI at the wrong URL
BYou did not include the <code>springdoc-openapi-starter-webmvc-ui</code> dependency correctly
CYou have not defined an OpenAPI bean in your configuration
DYou forgot to add the <code>@SpringBootApplication</code> annotation
Step-by-Step Solution
Solution:
  1. Step 1: Check common reasons for 404 on Swagger UI

    Missing dependency or wrong annotation usually cause app startup errors, not 404 on UI page.
  2. Step 2: Verify URL correctness

    Swagger UI default URL is /swagger-ui/index.html, accessing other URLs like /swagger-ui.html causes 404.
  3. Final Answer:

    You are trying to access the Swagger UI at the wrong URL -> Option A
  4. Quick Check:

    404 on Swagger UI usually means wrong URL [OK]
Quick Trick: Check Swagger UI URL carefully if 404 occurs [OK]
Common Mistakes:
  • Assuming missing OpenAPI bean causes 404
  • Thinking missing @SpringBootApplication causes 404 instead of startup failure
  • Ignoring URL path correctness

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes