Performance: SpringDoc OpenAPI setup
This affects the initial page load speed of the API documentation UI and the backend response time for OpenAPI JSON generation.
springdoc:
packages-to-scan: com.example.api
api-docs:
path: /v3/api-docs
swagger-ui:
enabled: true
# Limits scanning to API packages onlyspringdoc:
api-docs:
path: /v3/api-docs
swagger-ui:
enabled: true
# No package filtering, scans entire application including unused classes| Pattern | Backend Startup Delay | API Docs JSON Size | Frontend Load Impact | Verdict |
|---|---|---|---|---|
| Scan entire app packages | 200-500ms extra | 100-150kb | LCP +300-600ms | [X] Bad |
| Scan only API packages | 50-150ms extra | 20-50kb | LCP +50-150ms | [OK] Good |
| Swagger UI always enabled | N/A | N/A | Adds 200-300kb bundle, LCP +300-600ms | [X] Bad |
| Swagger UI enabled only in dev | N/A | N/A | Saves 200-300kb bundle, faster LCP | [OK] Good |
springdoc-openapi-starter-webmvc-ui dependency in a Spring Boot project?@SpringBootApplication
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}springdoc-openapi-starter-webmvc-ui is added as dependency and no custom properties are set.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?Pass the test and this pattern moves unknown