Skip to content
Sharp

Spring Core · interview question

In Spring Boot, how can you exclude a specific auto-configuration class from being applied?

Multiple choiceMediumchapter-9-curatedpremiumspring-coreinversion-of-control-ioc
Choose one answer
Answer and explanation

Correct answer

B. Use the @EnableAutoConfiguration(exclude = {ClassName.class}) annotation.

Why

You can exclude specific auto-configuration classes by using the @EnableAutoConfiguration annotation with the exclude attribute. This allows developers to prevent specific configurations from being applied, providing finer control over the application context.

Test yourself on Spring Core

A free test with instant, explained results. No account needed.

Start free test
All Spring Core questions →