0Pricing
Spring Boot 4 Microservices & REST APIs · Lektion

SpringDoc zu Ihrem Projekt hinzufügen

Generieren Sie OpenAPI-Dokumentation automatisch.

SpringDoc zu Ihrem Projekt hinzufügen ist eine kostenlose Spring Boot 4 Microservices & REST APIs-Lektion auf CoddyKit. Dies ist Lektion 1 von 4. Du kannst die komplette Lektion unten kostenlos lesen – dann übst du sie direkt im Browser mit einem integrierten Code-Editor und einem KI-Tutor rund um die Uhr. Sie ist Teil des Spring Boot 4 Microservices & REST APIs-Lernpfads, und dein Fortschritt wird über Web und CoddyKit-App synchronisiert. Der Spring Boot 4 Microservices & REST APIs-Kurs umfasst insgesamt 4 Lektionen.

Teile dieser Lektion wurden noch nicht übersetzt und werden auf Englisch angezeigt.

Why document your API?

An API without docs is hard to consume. OpenAPI (formerly Swagger) is a standard, machine-readable description of your REST API that powers interactive docs, client generation and contract testing.

What SpringDoc does

SpringDoc OpenAPI inspects your Spring controllers at runtime and generates the OpenAPI spec automatically - no hand-written YAML needed.

  • Reads your @RestController mappings
  • Serves the spec and a Swagger UI

Adding the starter (Maven)

Add the springdoc-openapi-starter-webmvc-ui dependency. The -ui variant bundles Swagger UI as well as the JSON spec.

<dependency>
  <groupId>org.springdoc</groupId>
  <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
  <version>2.6.0</version>
</dependency>

Adding the starter (Gradle)

The Gradle coordinates are the same artifact.

implementation "org.springdoc:springdoc-openapi-starter-webmvc-ui:2.6.0"

WebMVC vs WebFlux

Pick the starter matching your stack:

  • Servlet apps -> springdoc-openapi-starter-webmvc-ui
  • Reactive apps -> springdoc-openapi-starter-webflux-ui

Zero config to start

With just the dependency, start the app and SpringDoc auto-configures everything. You immediately get the generated spec and UI without writing any code.

The generated JSON endpoint

The raw OpenAPI document is served at /v3/api-docs by default. This JSON can feed code generators, Postman, or API gateways.

// GET http://localhost:8080/v3/api-docs
// returns the full OpenAPI 3 JSON document

The Swagger UI endpoint

The interactive UI is at /swagger-ui.html. It lists every endpoint and lets you try requests in the browser.

// open http://localhost:8080/swagger-ui.html

Changing the default paths

You can relocate the spec and UI via properties, useful behind a gateway or to avoid collisions.

# application.yml
springdoc:
  api-docs:
    path: /api-docs
  swagger-ui:
    path: /docs.html

What gets detected automatically

SpringDoc infers a lot with no annotations: paths, HTTP methods, path/query params, request and response body schemas from your DTO classes, and response status codes.

Disabling in production (optional)

Some teams expose docs only in non-prod. Toggle with properties so the spec and UI are not served in production.

# disable everywhere
springdoc:
  api-docs:
    enabled: false
  swagger-ui:
    enabled: false

Quick Check

Confirm the basics of adding SpringDoc.

Recap

You bootstrapped API docs:

  • SpringDoc generates the OpenAPI spec from your controllers
  • Add springdoc-openapi-starter-webmvc-ui (or webflux)
  • Spec at /v3/api-docs, UI at /swagger-ui.html
  • Paths and enablement are configurable via properties

Häufig gestellte Fragen

Ist die Lektion „SpringDoc zu Ihrem Projekt hinzufügen“ kostenlos?

Ja — der vollständige Text von „SpringDoc zu Ihrem Projekt hinzufügen“ ist hier im Web kostenlos zu lesen. Um sie interaktiv zu üben (integrierter Code-Editor und 24/7 KI-Tutor) und den Rest des Spring Boot 4 Microservices & REST APIs-Kurses freizuschalten, upgrade auf CoddyKit PRO. Der Spring Boot 4 Microservices & REST APIs-Kurs umfasst insgesamt 4 Lektionen.

Was lerne ich in „SpringDoc zu Ihrem Projekt hinzufügen“?

Generieren Sie OpenAPI-Dokumentation automatisch. Du übst Spring Boot 4 Microservices & REST APIs mit praktischem Code, den du direkt im Browser ausführst, und ein 24/7 KI-Tutor beantwortet deine Fragen während du die Lektion bearbeitest.

Brauche ich Erfahrung, um Spring Boot 4 Microservices & REST APIs zu starten?

Keine Vorkenntnisse erforderlich. Spring Boot 4 Microservices & REST APIs auf CoddyKit ist für Anfänger bis fortgeschrittene Lernende strukturiert, sodass du hier starten oder von Anfang an beginnen und in deinem eigenen Tempo voranschreiten kannst. Dies ist Lektion 1 von 4.

Wie lange dauert die Lektion „SpringDoc zu Ihrem Projekt hinzufügen“?

Die meisten CoddyKit-Lektionen dauern etwa 5–10 Minuten. Jede ist kompakt und interaktiv, sodass du stetig Fortschritte machst und genau dort weitermachst, wo du aufgehört hast – im Web und in der App.

Kann ich in dieser Spring Boot 4 Microservices & REST APIs-Lektion Code schreiben und ausführen?

Ja. Jede Spring Boot 4 Microservices & REST APIs-Lektion enthält einen integrierten Code-Editor, sodass du echten Code direkt in deinem Browser schreibst und ausführst und sofort KI-Feedback erhältst — ohne lokale Einrichtung erforderlich.

Alle Lektionen in diesem Kurs

  1. SpringDoc zu Ihrem Projekt hinzufügen
  2. Endpunkte und Modelle dokumentieren
  3. Die OpenAPI-Spezifikation anpassen
  4. Swagger UI
← Zurück zu Spring Boot 4 Microservices & REST APIs