0
0
Spring Bootframework~5 mins

Custom auto-configuration in Spring Boot - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is custom auto-configuration in Spring Boot?
Custom auto-configuration lets you create your own automatic setup for Spring Boot apps. It helps add features or settings without writing extra code each time.
Click to reveal answer
beginner
Which annotation marks a class as an auto-configuration class in Spring Boot?
The <code>@Configuration</code> annotation marks the class as a configuration, and <code>@ConditionalOnClass</code> or other <code>@Conditional</code> annotations control when it applies.
Click to reveal answer
intermediate
How does Spring Boot know to load your custom auto-configuration?
You list your auto-configuration class in a file named <code>META-INF/spring.factories</code> under the key <code>org.springframework.boot.autoconfigure.EnableAutoConfiguration</code>.
Click to reveal answer
intermediate
What is the role of @ConditionalOnClass in custom auto-configuration?
It makes sure your auto-configuration runs only if a certain class is on the classpath, avoiding errors if dependencies are missing.
Click to reveal answer
beginner
Why use custom auto-configuration instead of manual configuration?
It saves time by automating setup, reduces repeated code, and makes your app easier to maintain and extend.
Click to reveal answer
What file must you create to register your custom auto-configuration in Spring Boot?
Aapplication.properties
Bpom.xml
CMETA-INF/spring.factories
Dsrc/main/resources/config.yaml
Which annotation helps your auto-configuration activate only when a specific class is present?
A@ConditionalOnClass
B@Component
C@EnableAutoConfiguration
D@ConditionalOnBean
What is the main benefit of custom auto-configuration?
AWriting XML configuration
BManual setup of beans
CDisabling Spring Boot features
DAutomatic setup of features
Which annotation is essential to mark a class as a configuration source in Spring Boot?
A@Component
B@Configuration
C@Service
D@Repository
Where do you place your custom auto-configuration class in a Spring Boot project?
AUnder src/main/java with @Configuration
BIn src/test/java
CIn resources folder
DIn META-INF folder
Explain how to create and register a custom auto-configuration in Spring Boot.
Think about the steps from writing the class to telling Spring Boot about it.
You got /3 concepts.
    Describe why conditional annotations are important in custom auto-configuration.
    Consider what happens if a class your config needs is not present.
    You got /3 concepts.