Bird
0
0

What is the recommended way to exclude a specific auto-configuration class in Spring Boot without removing its dependency?

hard📝 Application Q9 of 15
Spring Boot - Fundamentals
What is the recommended way to exclude a specific auto-configuration class in Spring Boot without removing its dependency?
ADelete the auto-configuration class from the classpath
BUse the <code>exclude</code> attribute of <code>@SpringBootApplication</code>
CRemove the dependency from <code>pom.xml</code> or <code>build.gradle</code>
DAnnotate the auto-configuration class with <code>@ConditionalOnMissingBean</code>
Step-by-Step Solution
Solution:
  1. Step 1: Understand exclusion options

    Spring Boot allows excluding auto-config classes via annotation attributes.
  2. Step 2: Use exclude attribute

    The exclude attribute on @SpringBootApplication disables specific auto-config classes without removing dependencies.
  3. Final Answer:

    Use the exclude attribute of @SpringBootApplication -> Option B
  4. Quick Check:

    Exclude auto-config via annotation attribute [OK]
Quick Trick: Exclude auto-config classes via @SpringBootApplication exclude [OK]
Common Mistakes:
  • Trying to delete classes from dependencies
  • Removing dependencies instead of excluding
  • Misusing conditional annotations on auto-config classes

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes