Complete the code to enable Spring Boot auto-configuration in the main application class.
@SpringBootApplication public class Application { public static void main(String[] args) { SpringApplication.[1](Application.class, args); } }
The SpringApplication.run() method starts the Spring Boot application and triggers auto-configuration.
Complete the annotation to enable Spring Boot's auto-configuration feature.
@[1] public class Application {}
The @SpringBootApplication annotation includes auto-configuration, component scan, and configuration.
Fix the error in the code to correctly exclude a specific auto-configuration class.
@SpringBootApplication(exclude = [1].class) public class Application {}
To exclude an auto-configuration, specify the exact class name like DataSourceAutoConfiguration.class.
Fill both blanks to create a conditional auto-configuration class that activates only if a bean is missing.
@Configuration @ConditionalOnMissingBean([1].class) public class [2]AutoConfiguration {}
This auto-configuration activates only if no DataSource bean exists, so it provides a default DataSourceAutoConfiguration.
Fill all three blanks to define a custom auto-configuration class with proper annotations and bean method.
@Configuration @ConditionalOnClass([1].class) public class [2]AutoConfiguration { @Bean public [1] [3]() { return new [1](); } }
This defines an auto-configuration that creates a RestTemplate bean if the class is on the classpath.