Spring Boot: Intermediate Customizing Auto-Configuration Techniques
Test your knowledge on customizing auto-configuration in Spring Boot applications.
Questions in this quiz
12 questions on Spring Boot: Intermediate Customizing Auto-Configuration Techniques. Work through them here, then start the quiz to answer them and see your score.
1.What is the primary purpose of Spring Boot's auto-configuration feature?
- ATo replace manual configuration with XML files.
- BTo automatically configure a Spring application based on the dependencies present on the classpath.
- CTo enforce strict security policies in Spring applications.
- DTo provide a default database connection for all Spring applications.
2.Which annotation is used to exclude a specific auto-configuration class in a Spring Boot application?
- A@SpringBootApplication
- B@EnableAutoConfiguration
- C@ComponentScan
- D@EnableAutoConfiguration(exclude = {MyAutoConfiguration.class})
3.How can you customize the behavior of an auto-configured bean in Spring Boot?
- ABy creating a bean of the same type in your configuration class.
- BBy using XML configuration files.
- CBy modifying the application.properties file.
- DBy changing the main class name.
4.Which property would you set in application.properties to disable a specific auto-configuration class?
- Aspring.application.name
- Bspring.autoconfigure.exclude
- Cspring.main.allow-bean-definition-overriding
- Dspring.config.name
5.What does the @ConditionalOnMissingBean annotation do in a Spring Boot application?
- AIt ensures a bean is created regardless of other beans.
- BIt disables a bean if another bean is present.
- CIt creates a bean only if a specific property is set.
- DIt ensures a bean is only created if another bean is missing.
6.Which classpath condition can be used to conditionally load a bean based on the presence of a class?
- A@ConditionalOnBean
- B@ConditionalOnClass
- C@ConditionalOnProperty
- D@ConditionalOnMissingClass
7.What is the role of the @ConfigurationProperties annotation in Spring Boot?
- ATo bind external properties to a Java object.
- BTo define a new configuration class.
- CTo exclude a bean from auto-configuration.
- DTo enable auto-configuration for a specific bean.
8.Which annotation would you use to ensure a bean is only created if a specific property is set to a particular value?
- A@ConditionalOnMissingBean
- B@ConditionalOnExpression
- C@ConditionalOnClass
- D@ConditionalOnProperty
9.What is the purpose of the META-INF/spring.factories file in a Spring Boot project?
- ATo specify the main application class.
- BTo configure security settings.
- CTo register auto-configuration classes.
- DTo define application properties.
10.How can you provide custom logic to determine if an auto-configuration should be applied?
- ABy implementing the Condition interface.
- BBy changing the main class package.
- CBy modifying the application.yml file.
- DBy using the @Autowired annotation.
11.Which annotation is used to indicate that a configuration class should be processed last?
- A@AutoConfigurePriority
- B@AutoConfigureAfter
- C@AutoConfigureBefore
- D@AutoConfigureOrder
12.What is the effect of using the @SpringBootApplication annotation in a Spring Boot application?
- AIt combines @Configuration, @EnableAutoConfiguration, and @ComponentScan.
- BIt disables auto-configuration.
- CIt only enables component scanning.
- DIt provides a default application context.