0
0
Spring Bootframework~10 mins

@SpringBootApplication breakdown - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to mark the main class as a Spring Boot application.

Spring Boot
@[1]
public class MyApp {
    public static void main(String[] args) {
        SpringApplication.run(MyApp.class, args);
    }
}
Drag options to blanks, or click blank then click option'
AComponentScan
BSpringBootApplication
CEnableAutoConfiguration
DConfiguration
Attempts:
3 left
💡 Hint
Common Mistakes
Using only @Configuration instead of @SpringBootApplication
Forgetting to annotate the main class
2fill in blank
medium

Complete the code to enable component scanning in a Spring Boot app.

Spring Boot
@ComponentScan(basePackages = {"[1]"})
public class AppConfig {}
Drag options to blanks, or click blank then click option'
Acom.example.app
Bjavax.servlet
Cjava.util
Dorg.springframework.boot
Attempts:
3 left
💡 Hint
Common Mistakes
Using unrelated package names
Leaving the package empty
3fill in blank
hard

Fix the error in the annotation to enable auto-configuration.

Spring Boot
@Enable[1]
public class Config {}
Drag options to blanks, or click blank then click option'
AAutoConfiguration
BConfiguration
CComponentScan
DSpringBootApplication
Attempts:
3 left
💡 Hint
Common Mistakes
Using @EnableConfiguration instead
Confusing with @ComponentScan
4fill in blank
hard

Fill both blanks to complete the combined annotation equivalent to @SpringBootApplication.

Spring Boot
@Configuration
@[1]
@[2]
public class App {}
Drag options to blanks, or click blank then click option'
AEnableAutoConfiguration
BComponentScan
CSpringBootApplication
DEnableScheduling
Attempts:
3 left
💡 Hint
Common Mistakes
Using @EnableScheduling instead of @ComponentScan
Missing one of the annotations
5fill in blank
hard

Fill all three blanks to explain what @SpringBootApplication does internally.

Spring Boot
The @SpringBootApplication annotation is a shortcut for:
@Configuration
@[1]
@[2]
It also enables [3] scanning.
Drag options to blanks, or click blank then click option'
AEnableAutoConfiguration
BComponentScan
Cauto
DEnableScheduling
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing scheduling with auto-configuration
Missing the component scan part