Bird
0
0

Which annotation is commonly used to add metadata for Swagger UI documentation in Spring Boot?

easy📝 Conceptual Q2 of 15
Spring Boot - API Documentation
Which annotation is commonly used to add metadata for Swagger UI documentation in Spring Boot?
A@OpenAPIDefinition
B@RestController
C@Entity
D@Service
Step-by-Step Solution
Solution:
  1. Step 1: Identify Swagger metadata annotation

    @OpenAPIDefinition is used to provide global API metadata for Swagger UI.
  2. Step 2: Eliminate unrelated annotations

    @RestController, @Entity, and @Service serve other Spring roles, not Swagger metadata.
  3. Final Answer:

    @OpenAPIDefinition -> Option A
  4. Quick Check:

    Swagger metadata annotation = @OpenAPIDefinition [OK]
Quick Trick: Use @OpenAPIDefinition for Swagger metadata [OK]
Common Mistakes:
  • Using @RestController for Swagger metadata
  • Confusing @Entity with API docs
  • Assuming @Service adds Swagger info

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes