Spring Framework Technology & Digital Applications 2 — Questions and Answers
Question 1: Which Spring Boot auto-configuration class sets up an embedded Tomcat server?
- EmbeddedWebServerFactoryCustomizerAutoConfiguration
- ServletWebServerFactoryAutoConfiguration (Correct answer)
- TomcatServletWebServerFactory
- WebMvcAutoConfiguration
Correct answer: ServletWebServerFactoryAutoConfiguration
ServletWebServerFactoryAutoConfiguration triggers embedded server setup, delegating to factory beans like TomcatServletWebServerFactory.
Question 2: What is the purpose of Spring's @ConditionalOnMissingBean annotation?
- Registers a bean only if a specific class is on the classpath
- Registers a bean only if no bean of that type already exists in the context (Correct answer)
- Prevents a bean from being registered in production profiles
- Marks a bean as optional and nullable
Correct answer: Registers a bean only if no bean of that type already exists in the context
@ConditionalOnMissingBean allows auto-configuration to back off when the developer has already defined their own bean of that type.
Question 3: In Spring WebFlux, which scheduler is appropriate for blocking I/O operations?
- Schedulers.parallel()
- Schedulers.single()
- Schedulers.boundedElastic() (Correct answer)
- Schedulers.immediate()
Correct answer: Schedulers.boundedElastic()
Schedulers.boundedElastic() creates an elastic thread pool designed to offload blocking calls without starving the event loop.
Question 4: Which Spring Cloud component provides client-side load balancing integrated with the reactive WebClient?
- Ribbon
- Spring Cloud LoadBalancer (Correct answer)
- Feign
- Eureka Client
Correct answer: Spring Cloud LoadBalancer
Spring Cloud LoadBalancer is the modern replacement for Ribbon and integrates natively with both WebClient and RestTemplate.
Question 5: What does the @EnableConfigurationProperties annotation do in a Spring Boot application?
- Enables reading properties from environment variables only
- Registers @ConfigurationProperties-annotated classes as Spring beans (Correct answer)
- Refreshes configuration at runtime without restart
- Validates all @Value-injected properties on startup
Correct answer: Registers @ConfigurationProperties-annotated classes as Spring beans
@EnableConfigurationProperties scans for and registers classes annotated with @ConfigurationProperties so they are managed by the Spring container.
Question 6: In Spring Security, what is the role of the SecurityFilterChain bean?
- Defines the password encoding strategy for the application
- Configures HTTP security rules, authentication, and filter ordering (Correct answer)
- Provides CSRF token storage and validation logic
- Sets up OAuth2 client registration details
Correct answer: Configures HTTP security rules, authentication, and filter ordering
SecurityFilterChain defines the chain of security filters and HTTP rules (e.g., URL patterns, session management, CSRF) applied to requests.
Question 7: Which annotation enables Spring's asynchronous method execution support?
- @EnableScheduling
- @EnableAsync (Correct answer)
- @Async
- @EnableConcurrency
Correct answer: @EnableAsync
@EnableAsync placed on a @Configuration class activates the proxy infrastructure that processes @Async method annotations.
Which Spring Boot auto-configuration class sets up an embedded Tomcat server?