Spring Framework Research & Evidence-Based Practice 3 — Questions and Answers
Question 1: Which Spring Boot Actuator endpoint exposes a structured health check that can be used as evidence of application readiness in CI/CD pipelines?
- /actuator/info
- /actuator/health (Correct answer)
- /actuator/metrics
- /actuator/env
Correct answer: /actuator/health
The /actuator/health endpoint returns a structured JSON report of application health indicators, commonly used as readiness/liveness probes in CI/CD and Kubernetes.
Question 2: A team wants to validate Spring Security configuration changes don't break existing access rules. What is the recommended evidence-based testing strategy?
- Manual browser testing only
- Use @WithMockUser and MockMvc security tests (Correct answer)
- Deploy to production and monitor error logs
- Review code with a security checklist
Correct answer: Use @WithMockUser and MockMvc security tests
@WithMockUser combined with MockMvc allows automated, repeatable security integration tests that verify access rules without requiring a running server.
Question 3: What Spring framework feature enables reproducible, data-driven tests by pre-populating the database with known state before each test?
- @Sql annotation (Correct answer)
- @Transactional rollback
- @MockBean
- @PropertySource
Correct answer: @Sql annotation
@Sql allows specifying SQL scripts to execute before or after a test method, ensuring a known and reproducible database state for evidence-based testing.
Question 4: When researching Spring bean initialization order issues, which tool provided by Spring Framework helps visualize the dependency graph?
- Spring Boot Admin UI
- ApplicationContext.getBeanDefinitionNames() combined with dependency introspection (Correct answer)
- Spring DevTools LiveReload
- Spring Cloud Config dashboard
Correct answer: ApplicationContext.getBeanDefinitionNames() combined with dependency introspection
Programmatic inspection via getBeanDefinitionNames() and BeanFactory dependency APIs, or IDE plugins, are the evidence-based approaches for diagnosing Spring bean dependency ordering issues.
Question 5: Which JMH (Java Microbenchmark Harness) integration practice is recommended when benchmarking Spring-managed beans to get accurate results?
- Instantiate beans manually inside the benchmark method
- Initialize the Spring context in @Setup and inject beans before timing (Correct answer)
- Use @Autowired directly in the JMH benchmark class
- Run benchmarks inside @SpringBootTest
Correct answer: Initialize the Spring context in @Setup and inject beans before timing
The recommended practice is to initialize the Spring context once in a @Setup method and inject beans before the timed benchmark loop, isolating context startup from the measured operation.
Question 6: A researcher comparing Spring MVC vs Spring WebFlux throughput should primarily measure which metric under high concurrency?
- Lines of code per endpoint
- Requests per second at a defined latency percentile (e.g., p99) (Correct answer)
- Number of active Spring beans
- Build compilation time
Correct answer: Requests per second at a defined latency percentile (e.g., p99)
Requests-per-second at a defined latency percentile (p99) is the evidence-based metric for comparing throughput and tail latency between Spring MVC and WebFlux under concurrency.
Question 7: Spring's @ConditionalOnProperty annotation is frequently used in evidence-based configuration. What happens if the specified property is absent and matchIfMissing is not set?
- The bean is registered with a default value
- The condition evaluates to false and the bean is not registered (Correct answer)
- Spring throws a BeanDefinitionException
- The property is auto-created in application.properties
Correct answer: The condition evaluates to false and the bean is not registered
By default, if the property is absent and matchIfMissing is not specified (defaults to false), @ConditionalOnProperty evaluates to false and the bean is skipped.
Which Spring Boot Actuator endpoint exposes a structured health check that can be used as evidence of application readiness in CI/CD pipelines?