0Pricing
Spring Boot 4 Microservices & REST APIs · Lektion

Swagger UI

Erkunden und testen Sie APIs interaktiv.

Swagger UI ist eine kostenlose Spring Boot 4 Microservices & REST APIs-Lektion auf CoddyKit. Dies ist Lektion 4 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.

What is Swagger UI?

Swagger UI renders your OpenAPI spec as an interactive web page. Developers can browse endpoints, read schemas, and send live requests - all from the browser.

Where it lives

With the -ui starter, Swagger UI is served at /swagger-ui.html by default. It loads the spec from /v3/api-docs.

// open in a browser:
// http://localhost:8080/swagger-ui.html

Try it out

Each operation has a Try it out button. You fill in parameters and body, click Execute, and the UI shows the real request URL, response status, headers and body.

Reading the schema view

The Schemas section at the bottom lists every model with field types, descriptions and examples taken from your @Schema annotations.

Changing the UI path

Relocate the UI with a property - useful when serving docs under a custom route.

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

Sorting endpoints and tags

By default operations appear in an unsorted order. Properties let you sort operations and tags alphabetically for a cleaner page.

springdoc:
  swagger-ui:
    operations-sorter: alpha
    tags-sorter: alpha

Trying secured endpoints

If you declared a security scheme, the UI shows an Authorize button. Enter a token once and it is attached to every secured request you try.

Filtering operations

Enable a search box to filter the long list of endpoints by name, which helps in large APIs.

springdoc:
  swagger-ui:
    filter: true

Display options

You can control how much is expanded by default and whether request duration is shown, tuning the UI for your team's taste.

springdoc:
  swagger-ui:
    doc-expansion: none      # collapse all by default
    display-request-duration: true

Securing the UI itself

Swagger UI exposes your API surface. In production, protect /swagger-ui/** and /v3/api-docs/** with Spring Security, or disable them, so they are not publicly browsable.

// permit only authenticated users
http.authorizeHttpRequests(a -> a
    .requestMatchers("/swagger-ui/**", "/v3/api-docs/**").authenticated()
    .anyRequest().permitAll());

UI vs spec - division of labor

Remember: Swagger UI is just a viewer. The source of truth is the OpenAPI spec generated from your code and annotations. Improve the docs by improving annotations, not the UI.

Quick Check

Confirm your Swagger UI knowledge.

Recap

You explored Swagger UI:

  • Served at /swagger-ui.html, backed by /v3/api-docs
  • Try it out sends live requests; Authorize adds tokens
  • Sort, filter and expansion are configurable via properties
  • Protect or disable the UI in production

Häufig gestellte Fragen

Ist die Lektion „Swagger UI“ kostenlos?

Ja — der vollständige Text von „Swagger UI“ 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 „Swagger UI“?

Erkunden und testen Sie APIs interaktiv. 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 4 von 4.

Wie lange dauert die Lektion „Swagger UI“?

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