Complete the code to mark the main class as a Spring Boot application.
@[1] public class MyApp { public static void main(String[] args) { SpringApplication.run(MyApp.class, args); } }
The @SpringBootApplication annotation marks the main class as a Spring Boot application. It combines several important annotations.
Complete the code to enable component scanning in a Spring Boot app.
@ComponentScan(basePackages = {"[1]"})
public class AppConfig {}Component scanning looks for components in the specified package. Usually, you scan your app's base package.
Fix the error in the annotation to enable auto-configuration.
@Enable[1] public class Config {}
The @EnableAutoConfiguration annotation tells Spring Boot to automatically configure beans based on classpath settings.
Fill both blanks to complete the combined annotation equivalent to @SpringBootApplication.
@Configuration @[1] @[2] public class App {}
The @SpringBootApplication annotation combines @Configuration, @EnableAutoConfiguration, and @ComponentScan.
Fill all three blanks to explain what @SpringBootApplication does internally.
The @SpringBootApplication annotation is a shortcut for: @Configuration @[1] @[2] It also enables [3] scanning.
@SpringBootApplication combines @EnableAutoConfiguration and @ComponentScan, and it enables auto scanning of components.