Spring Boot Core & Auto-Configuration
Test your understanding of @SpringBootApplication, auto-configuration, starters, and the Spring application lifecycle.
Questions in this quiz
10 questions on Spring Boot Core & Auto-Configuration. Work through them here, then start the quiz to answer them and see your score.
1.What does @SpringBootApplication combine?
- A@Controller + @Service + @Repository
- B@Component + @Autowired + @Qualifier
- C@Configuration + @EnableAutoConfiguration + @ComponentScan
- D@RestController + @RequestMapping + @Bean
2.Where does Spring Boot look for auto-configuration classes?
- AMETA-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
- Bsrc/main/resources/auto-config.properties
- CMETA-INF/MANIFEST.MF
- DWEB-INF/spring-config.xml
3.What annotation prevents an auto-configuration from applying if a bean already exists?
- A@ConditionalOnProperty
- B@ConditionalOnWebApplication
- C@ConditionalOnClass
- D@ConditionalOnMissingBean
4.What does spring-boot-starter-web pull in by default?
- ASpring MVC, Hibernate, and H2 in-memory database
- BSpring MVC, Jackson, and an embedded Tomcat server
- CSpring MVC, Thymeleaf, and embedded Jetty
- DSpring WebFlux, Netty, and Jackson
5.Which file is loaded first before application.properties?
- Abootstrap.properties (Spring Cloud)
- Benv.properties
- Csystem.properties
- Ddefaults.properties
6.What is the purpose of @SpringBootTest?
- ALoad the full application context for integration tests
- BMock all beans automatically
- CStart a real embedded database
- DRun unit tests without the Spring context
7.How do you change the embedded server port?
- AAnnotate main class with @Port(8081)
- BSet server.port in application.properties
- COverride SpringApplication.getPort()
- DSet PORT in the @SpringBootApplication annotation
8.What does @ConditionalOnProperty(name = "feature.enabled", havingValue = "true") do?
- AActivates the bean only when feature.enabled=true in properties
- BDisables the bean if the property is true
- CCreates the property with value true if it does not exist
- DMakes the property required at startup
9.What is a "fat JAR" in Spring Boot?
- AA JAR that includes the JDK
- BA JAR larger than 100MB
- CAn executable JAR containing the application and all its dependencies
- DA WAR file renamed to JAR
10.Which annotation reads a group of related properties into a Java object?
- A@Value
- B@PropertySource
- C@Environment
- D@ConfigurationProperties