Spring Boot Auto Configuration aims to reduce the developer's need to define beans in the configuration file. Whether you're a newbie discovering the realms of Spring Boot or simply want to refresh your foundational knowledge, this MCQ guide on Spring Boot Auto Configurations is your handy companion. Let's jump in!
1. What is the main objective of Spring Boot Auto Configuration?
Answer:
Explanation:
Auto Configuration's primary goal is to simplify Spring application setups by configuring beans automatically based on the libraries present on the classpath.
2. How can you disable a specific auto-configuration?
Answer:
Explanation:
You can exclude specific auto-configurations using the @EnableAutoConfiguration annotation with its exclude attribute.
3. Which file is responsible for listing all the auto-configuration classes in Spring Boot?
Answer:
Explanation:
The spring.factories file inside the META-INF directory lists all the auto-configuration classes.
4. What annotation is typically used with main application class to enable auto-configuration?
Answer:
Explanation:
The @SpringBootApplication annotation includes @EnableAutoConfiguration and is typically used with the main application class to enable auto-configuration.
5. If two beans of the same type are defined, and you don't specify which one to autowire, what happens?
Answer:
Explanation:
If there are two beans of the same type and no specific bean is chosen for autowiring, Spring throws a 'No qualifying bean of type' exception.
6. Which of the following is NOT a feature of Spring Boot Auto Configuration?
Answer:
Explanation:
While auto configuration reduces bean specifications, manages embedded servlets, and creates template beans, it doesn't handle property validation by itself.
7. How can you find out what auto-configurations have been applied?
Answer:
Explanation:
The /autoconfig actuator endpoint provides insights on which auto-configurations have been applied and which have not.
8. What property can be set to trace the conditions evaluated during auto-configuration?
Answer:
Explanation:
Setting the debug property to true allows tracing the conditions that were evaluated during auto-configuration.
9. In which package is the primary auto-configuration logic for Spring Boot located?
Answer:
Explanation:
The main auto-configuration logic is present in the org.springframework.boot.autoconfigure package.
10. When does Spring Boot apply auto-configuration?
Answer:
Explanation:
Spring Boot applies auto-configuration after all user-defined beans have been registered.
11. To explicitly define the order of auto-configuration, which annotation should be used?
Answer:
Explanation:
The @Order annotation can be used to explicitly define the order in which auto-configurations should be applied.
12. Which Spring Boot starter is fundamental to enable auto-configuration?
Answer:
Explanation:
The spring-boot-autoconfigure starter contains the auto-configuration support necessary for Spring Boot applications.
Related Spring Boot MCQ Posts
- Spring Boot Starters MCQ - Multiple Choice Questions and Answers
- Spring Boot Auto Configurations MCQ - Multiple Choice Questions and Answers
- Spring Boot Properties & Configuration MCQ - Multiple Choice Questions and Answers
- Spring Boot Data Access MCQ - Multiple Choice Questions and Answers
- Spring Boot Actuator MCQ - Multiple Choice Questions and Answers
- Spring Boot Security MCQ - Multiple Choice Questions and Answers
- Spring Boot Testing MCQ - Multiple Choice Questions and Answers
- Spring Boot Microservices MCQ - Multiple Choice Questions and Answers
Comments
Post a Comment
Leave Comment