Performance: SpringDoc OpenAPI setup
MEDIUM IMPACT
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 |