Bird
0
0

You added a custom OpenAPI bean but the Swagger UI still shows default info. What is the likely cause?

medium📝 Debug Q6 of 15
Spring Boot - API Documentation
You added a custom OpenAPI bean but the Swagger UI still shows default info. What is the likely cause?
AThe OpenAPI bean method is private instead of public
BThe @Bean method is missing the @Configuration annotation on the class
CThe springdoc-openapi dependency version is too new
DThe application.properties file is missing
Step-by-Step Solution
Solution:
  1. Step 1: Check bean registration requirements

    For Spring to detect @Bean methods, the class must be annotated with @Configuration or be a Spring component.
  2. Step 2: Understand impact of missing @Configuration

    Without @Configuration, the bean method is ignored, so default OpenAPI info is used.
  3. Final Answer:

    The @Bean method is missing the @Configuration annotation on the class -> Option B
  4. Quick Check:

    Missing @Configuration = bean ignored [OK]
Quick Trick: Add @Configuration to register OpenAPI bean [OK]
Common Mistakes:
  • Making bean method private
  • Blaming dependency version without checking config
  • Expecting properties file to override bean

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes