0
0
Spring Bootframework~20 mins

SpringDoc OpenAPI setup in Spring Boot - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
SpringDoc OpenAPI Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
component_behavior
intermediate
1:30remaining
What is the default OpenAPI path after adding SpringDoc dependency?
After adding the SpringDoc OpenAPI dependency to a Spring Boot project, which URL path will serve the OpenAPI JSON specification by default?
A/openapi.json
B/swagger-ui.html
C/v3/api-docs
D/api-docs
Attempts:
2 left
💡 Hint
Think about the default endpoint SpringDoc uses to expose the raw OpenAPI JSON.
📝 Syntax
intermediate
1:30remaining
Which dependency is required for SpringDoc OpenAPI in Maven?
Select the correct Maven dependency snippet to add SpringDoc OpenAPI UI support in a Spring Boot project.
A
<dependency>
  <groupId>org.springdoc</groupId>
  <artifactId>springdoc-openapi-ui</artifactId>
  <version>1.7.0</version>
</dependency>
B
<dependency>
  <groupId>io.swagger</groupId>
  <artifactId>swagger-ui</artifactId>
  <version>3.0.0</version>
</dependency>
C
<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-web</artifactId>
</dependency>
D
<dependency>
  <groupId>org.springdoc</groupId>
  <artifactId>springdoc-openapi-webmvc-core</artifactId>
  <version>1.7.0</version>
</dependency>
Attempts:
2 left
💡 Hint
Look for the artifact that includes UI support for SpringDoc.
🔧 Debug
advanced
2:00remaining
Why does Swagger UI not load after adding SpringDoc?
You added SpringDoc OpenAPI UI dependency and started your Spring Boot app. Accessing /swagger-ui.html returns 404. What is the most likely cause?
AYou forgot to add <code>@EnableSwagger2</code> annotation in your main class.
BThe correct URL is <code>/swagger-ui/index.html</code> or <code>/swagger-ui.html</code> is deprecated in newer SpringDoc versions.
CSpring Boot version is incompatible with SpringDoc and needs to be downgraded.
DYou need to manually create a controller to serve Swagger UI static files.
Attempts:
2 left
💡 Hint
Check the official SpringDoc documentation for the correct Swagger UI URL.
state_output
advanced
1:30remaining
What is the effect of setting springdoc.api-docs.path in application.properties?
If you set springdoc.api-docs.path=/custom-api-docs in your Spring Boot application.properties, what will be the new URL to access the OpenAPI JSON spec?
A/custom-api-docs
B/v3/api-docs
C/swagger-ui/custom-api-docs
D/api-docs/custom
Attempts:
2 left
💡 Hint
This property changes the base path for the OpenAPI JSON output.
🧠 Conceptual
expert
2:30remaining
How does SpringDoc integrate with Spring Boot to generate OpenAPI docs?
Which best describes how SpringDoc generates OpenAPI documentation in a Spring Boot application?
ASpringDoc replaces Spring MVC with a custom web framework to expose API docs.
BSpringDoc requires manual JSON files to be written and served by the application.
CSpringDoc uses compile-time code generation to create static OpenAPI files.
DSpringDoc scans Spring MVC controllers and their annotations at runtime to build the OpenAPI spec dynamically.
Attempts:
2 left
💡 Hint
Think about how SpringDoc uses existing code and annotations to create docs.