Spring Framework Research & Evidence-Based Practice 4 — Questions and Answers
Question 1: Which Spring Boot feature allows developers to observe actual auto-configuration decisions made at startup, providing evidence for why a bean was or was not created?
- spring.main.banner-mode=off
- ConditionEvaluationReport via /actuator/conditions or --debug flag (Correct answer)
- spring.jpa.show-sql=true
- logging.level.root=TRACE
Correct answer: ConditionEvaluationReport via /actuator/conditions or --debug flag
The ConditionEvaluationReport, accessible via the /actuator/conditions endpoint or the --debug startup flag, documents exactly which auto-configuration conditions matched or failed.
Question 2: When evaluating Spring Data query performance, which approach provides concrete evidence of the SQL generated by a derived query method?
- Reading the method name carefully
- Setting spring.jpa.show-sql=true and logging the output (Correct answer)
- Counting the repository method parameters
- Checking the Spring Data changelog
Correct answer: Setting spring.jpa.show-sql=true and logging the output
Setting spring.jpa.show-sql=true (or enabling Hibernate SQL logging) logs the actual SQL statements, giving direct evidence of what queries Spring Data generates.
Question 3: A Spring Boot application suffers from slow startup in production. Which evidence-based tool does Spring provide specifically to diagnose startup performance?
- Spring Boot Actuator /startup endpoint with ApplicationStartup (Correct answer)
- VisualVM heap dumps
- Thread dumps via jstack
- Spring Cloud Sleuth traces
Correct answer: Spring Boot Actuator /startup endpoint with ApplicationStartup
Spring Boot's ApplicationStartup API, combined with the /actuator/startup endpoint, records timestamped steps during context initialization to pinpoint slow startup contributors.
Question 4: What is the recommended evidence-based approach for verifying that Spring Cache (@Cacheable) is actually caching method results and not calling the underlying method twice?
- Add a System.out.println inside the method and read logs
- Use a spy or mock to count invocations and assert the method was called only once on repeated calls (Correct answer)
- Trust the annotation documentation
- Check the cache configuration file for typos
Correct answer: Use a spy or mock to count invocations and assert the method was called only once on repeated calls
Using Mockito.spy() or a counter in the real implementation and asserting the method is invoked only once on the second call provides concrete, measurable evidence that caching is working.
Question 5: Spring's documented 'fail-fast' principle recommends which behavior when required configuration properties are missing at startup?
- Log a warning and continue with null values
- Throw a startup exception before the application accepts traffic (Correct answer)
- Fall back to hardcoded defaults silently
- Prompt the user on the console for the missing value
Correct answer: Throw a startup exception before the application accepts traffic
The fail-fast principle, implemented via @ConfigurationProperties validation with @NotNull/@NotEmpty, causes Spring Boot to throw a BindException at startup, preventing a misconfigured app from serving traffic.
Question 6: Researchers studying Spring's transaction propagation use which test scenario to demonstrate that REQUIRES_NEW suspends the outer transaction?
- Call a REQUIRES_NEW method and verify both methods share the same EntityManager
- Roll back the outer transaction and verify the REQUIRES_NEW inner transaction's changes are still committed (Correct answer)
- Use a single @Transactional method with multiple save() calls
- Annotate the test with @Rollback(false) and manually inspect logs
Correct answer: Roll back the outer transaction and verify the REQUIRES_NEW inner transaction's changes are still committed
Rolling back the outer transaction and confirming the REQUIRES_NEW inner transaction's changes persisted is the definitive empirical test of transaction suspension behavior.
Question 7: When documenting evidence for a Spring Security vulnerability patch, which Spring resource provides CVE details and recommended remediation versions?
- Spring GitHub Discussions
- The official Spring Security CVE page at spring.io/security (Correct answer)
- JavaDoc of the patched class only
- Stack Overflow accepted answers
Correct answer: The official Spring Security CVE page at spring.io/security
The official Spring security advisories page at spring.io/security publishes CVE identifiers, affected versions, and recommended upgrade paths as the authoritative evidence source.
Which Spring Boot feature allows developers to observe actual auto-configuration decisions made at startup, providing evidence for why a bean was or was not created?