Recall & Review
beginner
What does the @SpringBootApplication annotation do in a Spring Boot project?
It marks the main class of a Spring Boot application and combines three important annotations: @Configuration, @EnableAutoConfiguration, and @ComponentScan to simplify setup.Click to reveal answer
intermediate
Which three annotations are combined inside @SpringBootApplication?
1. @Configuration - marks the class as a source of bean definitions.<br>2. @EnableAutoConfiguration - tells Spring Boot to start adding beans based on classpath settings.<br>3. @ComponentScan - enables scanning for other components, configurations, and services in the package.Click to reveal answer
beginner
Why is @ComponentScan important in @SpringBootApplication?
It tells Spring where to look for other components like controllers and services, usually scanning the package of the main class and its sub-packages automatically.Click to reveal answer
intermediate
What role does @EnableAutoConfiguration play in @SpringBootApplication?
It automatically configures Spring application based on the dependencies found on the classpath, reducing the need for manual configuration.
Click to reveal answer
beginner
Can you use @SpringBootApplication without specifying a base package for scanning?
Yes, by default it scans the package of the class annotated with @SpringBootApplication and its sub-packages, so usually no need to specify base packages explicitly.Click to reveal answer
What annotation does @SpringBootApplication NOT include?
✗ Incorrect
@SpringBootApplication includes @Configuration, @EnableAutoConfiguration, and @ComponentScan but NOT @RestController.
What is the main benefit of using @EnableAutoConfiguration?
✗ Incorrect
@EnableAutoConfiguration automatically configures beans based on the dependencies found on the classpath.
Where does @ComponentScan look for components by default?
✗ Incorrect
@ComponentScan scans the package where the annotated class is and all its sub-packages.
Which annotation would you use to mark a class as a source of bean definitions?
✗ Incorrect
@Configuration marks a class as a source of bean definitions.
Is it necessary to add @ComponentScan explicitly when using @SpringBootApplication?
✗ Incorrect
@ComponentScan is included inside @SpringBootApplication, so explicit use is usually not needed.
Explain what @SpringBootApplication does and why it is useful in a Spring Boot project.
Think about how it reduces the need for multiple annotations.
You got /4 concepts.
Describe the role of @EnableAutoConfiguration and how it helps developers.
Focus on automation and dependency detection.
You got /4 concepts.