0
0
Spring Bootframework~5 mins

@SpringBootApplication breakdown - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
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?
A@Configuration
B@EnableAutoConfiguration
C@ComponentScan
D@RestController
What is the main benefit of using @EnableAutoConfiguration?
AManually configure beans
BAutomatically configure beans based on dependencies
CScan for components
DStart the application server
Where does @ComponentScan look for components by default?
APackage of the annotated class and sub-packages
BExternal libraries
COnly the annotated class
DRoot package of the project
Which annotation would you use to mark a class as a source of bean definitions?
A@ComponentScan
B@EnableAutoConfiguration
C@Configuration
D@SpringBootApplication
Is it necessary to add @ComponentScan explicitly when using @SpringBootApplication?
ANo, it is included by default
BOnly for external packages
CYes, always
DOnly for testing
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.