0
0
Spring Bootframework~20 mins

Swagger UI integration in Spring Boot - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Swagger UI Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
component_behavior
intermediate
2:00remaining
Swagger UI Endpoint Accessibility
You have integrated Swagger UI in your Spring Boot application. After running the app, which URL will correctly display the Swagger UI page by default?
Ahttp://localhost:8080/docs
Bhttp://localhost:8080/swagger
Chttp://localhost:8080/swagger-ui.html
Dhttp://localhost:8080/api-docs
Attempts:
2 left
💡 Hint
Swagger UI default path usually ends with .html
📝 Syntax
intermediate
2:00remaining
Correct Swagger Configuration Bean
Which of the following code snippets correctly defines a Swagger configuration bean in Spring Boot using Springfox 3.x?
A
@Bean
public Docket api() {
    return new Docket(DocumentationType.OAS_30)
        .select()
        .apis(RequestHandlerSelectors.basePackage("com.example"))
        .paths(PathSelectors.any())
        .build();
}
B
@Bean
public SwaggerConfig api() {
    return new SwaggerConfig();
}
C
@Bean
public Docket api() {
    return new Docket(DocumentationType.SWAGGER_2)
        .select()
        .apis(RequestHandlerSelectors.any())
        .paths(PathSelectors.any())
        .build();
}
D
@Bean
public Docket api() {
    return new Docket(DocumentationType.SWAGGER_3)
        .select()
        .apis(RequestHandlerSelectors.any())
        .paths(PathSelectors.any())
        .build();
}
Attempts:
2 left
💡 Hint
Use the correct DocumentationType enum for OpenAPI 3.0 support
🔧 Debug
advanced
2:00remaining
Swagger UI Not Loading Static Resources
You added Swagger UI to your Spring Boot app, but the UI loads without styles and scripts, showing a broken page. What is the most likely cause?
ASwagger UI requires a separate server to serve static files
BIncorrect controller mapping for Swagger endpoints
CMissing dependency for springfox-swagger-ui in the build file
DSpring Security blocking access to Swagger static resources
Attempts:
2 left
💡 Hint
Check if security settings allow access to /swagger-ui/** and /v3/api-docs/**
🧠 Conceptual
advanced
2:00remaining
Purpose of @OpenAPIDefinition Annotation
What is the main purpose of the @OpenAPIDefinition annotation in a Spring Boot application using springdoc-openapi?
ATo define global metadata like title, version, and description for the OpenAPI documentation
BTo configure security schemes for API authentication
CTo enable Swagger UI endpoint in the application
DTo automatically generate REST controllers from OpenAPI specs
Attempts:
2 left
💡 Hint
Think about what metadata means for documentation
state_output
expert
3:00remaining
Effect of Multiple Docket Beans on Swagger UI
In a Spring Boot app, you define two Docket beans with different group names: apiV1 and apiV2. What will the Swagger UI display when accessed at /swagger-ui.html?
AOnly the apiV1 group APIs are shown by default
BA dropdown to select between apiV1 and apiV2 API groups
CAn error because multiple Docket beans are not supported
DSwagger UI shows combined APIs from both groups without distinction
Attempts:
2 left
💡 Hint
Swagger UI supports multiple API groups via dropdown selection