Bird
0
0

Which of the following is the correct way to customize the OpenAPI info using a bean in Spring Boot?

easy📝 Syntax Q3 of 15
Spring Boot - API Documentation
Which of the following is the correct way to customize the OpenAPI info using a bean in Spring Boot?
AUse @EnableOpenAPI annotation on the controller
BDefine a @Bean method returning OpenAPI with info set
CCreate a properties file named openapi.properties
DAdd @OpenAPIDefinition annotation on the main class only
Step-by-Step Solution
Solution:
  1. Step 1: Understand customization via bean

    SpringDoc allows customization by defining a @Bean method that returns an OpenAPI object with info details set.
  2. Step 2: Identify incorrect methods

    @OpenAPIDefinition is an annotation but does not replace bean customization; properties file and @EnableOpenAPI are not standard ways.
  3. Final Answer:

    Define a @Bean method returning OpenAPI with info set -> Option B
  4. Quick Check:

    Customize OpenAPI info = @Bean OpenAPI method [OK]
Quick Trick: Customize OpenAPI by returning OpenAPI bean [OK]
Common Mistakes:
  • Using non-existent @EnableOpenAPI annotation
  • Relying only on properties file for info customization
  • Misusing @OpenAPIDefinition without bean

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes