Swagger UI
Explorez et testez les API de manière interactive.
Swagger UI est une leçon Spring Boot 4 Microservices & REST APIs gratuite sur CoddyKit. Ceci est la leçon 4 sur 4. Tu peux lire la leçon complète ci-dessous gratuitement — puis la pratiquer en direct dans le navigateur avec un éditeur de code intégré et un tuteur IA 24/7. Elle fait partie du parcours d'apprentissage Spring Boot 4 Microservices & REST APIs, et ta progression se synchronise sur le web et l'application CoddyKit. Le cours Spring Boot 4 Microservices & REST APIs comprend 4 leçons au total.
Certaines parties de cette leçon n'ont pas encore été traduites et s'affichent en anglais.
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.htmlTry 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: /docsSorting 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: alphaTrying 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: trueDisplay 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: trueSecuring 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
Questions Fréquemment Posées
La leçon « Swagger UI » est-elle gratuite ?
Oui — le texte complet de « Swagger UI » est gratuit à lire ici sur le web. Pour la pratiquer de manière interactive (un éditeur de code intégré et un tuteur IA 24/7) et déverrouiller le reste du cours Spring Boot 4 Microservices & REST APIs, passe à CoddyKit PRO. Le cours Spring Boot 4 Microservices & REST APIs comprend 4 leçons au total.
Qu'est-ce que j'apprendrai dans « Swagger UI » ?
Explorez et testez les API de manière interactive. Tu pratiques Spring Boot 4 Microservices & REST APIs avec du code pratique que tu exécutes directement dans le navigateur, et un tuteur IA 24/7 répond à tes questions au fur et à mesure que tu avances dans la leçon.
Dois-je avoir de l'expérience pour commencer Spring Boot 4 Microservices & REST APIs ?
Aucune expérience préalable n'est requise. Spring Boot 4 Microservices & REST APIs sur CoddyKit est structuré pour les débutants jusqu'aux apprenants avancés, donc tu peux commencer ici ou depuis le début et avancer à ton rythme. Ceci est la leçon 4 sur 4.
Combien de temps prend la leçon « Swagger UI » ?
La plupart des leçons CoddyKit prennent environ 5–10 minutes. Chacune est courte et interactive, tu progresses régulièrement et tu repiques exactement où tu t'es arrêté sur le web et l'app.
Peux-tu écrire et exécuter du code dans cette leçon Spring Boot 4 Microservices & REST APIs ?
Oui. Chaque leçon Spring Boot 4 Microservices & REST APIs inclut un éditeur de code intégré, tu écris et exécutes du vrai code directement dans ton navigateur et tu reçois des retours IA instantanés — aucune configuration locale requise.
Toutes les leçons de ce cours
- Ajouter SpringDoc à votre projet
- Documenter les points de terminaison et les modèles
- Personnaliser la spécification OpenAPI
- Swagger UI