Scrivio Interview library

Auto-configuration

21 questions in 6 subtopics.

How auto-configuration works

ConceptFoundations5 min read
What does 'auto-configuration backs off' mean? Give an example with ObjectMapper or DataSource.
InternalsFoundations5 min read
Explain how @SpringBootApplication leads to a DataSource bean being created when you add spring-boot-starter-jdbc and a database driver.
InternalsIntermediate6 min read
Why does Boot filter auto-configuration candidates by class presence before loading them, and how is this done without loading every class?
LeadershipPrincipal5 min read
Spring Boot made convention over configuration the standard for Java services. Why did it win over explicit configuration, and what long-term costs does it bring to large organisations?

AutoConfiguration.imports

ConceptFoundations5 min read
What is the AutoConfiguration.imports file, where is it located, and what replaced it compared with Boot 2.6 and earlier?
DebuggingIntermediate5 min read
After upgrading a shared library to Boot 3, its auto-configuration is silently ignored in all consuming services. The library still has META-INF/spring.factories with an EnableAutoConfiguration entry. Explain and fix it.
DesignAdvanced6 min read
Your platform ships internal auto-configurations in a shared jar used by 150 services. How would you order them relative to Spring Boot's own auto-configurations and to each other, and how would you keep that ordering safe across Boot upgrades?

Conditional annotations

CodingFoundations5 min read
Read this:
@Bean
@ConditionalOnProperty(prefix = "feature.audit", name = "enabled", havingValue = "true", matchIfMissing = false)
AuditService audit() { ... }
When is the bean created?
ConceptIntermediate5 min read
Compare @ConditionalOnClass, @ConditionalOnMissingBean, @ConditionalOnWebApplication and @ConditionalOnExpression. Which would you avoid in a library and why?
DebuggingIntermediate5 min read
A custom auto-configuration uses @ConditionalOnBean(DataSource.class) but the bean is never created even though the application has a DataSource. What is the likely cause?
LeadershipPrincipal6 min read
Looking at conditional configuration over many years, where have you seen @Conditional-based designs create long-term risk in large estates, and what rules would you set so that conditional behaviour stays predictable?

Condition evaluation report

DebuggingFoundations6 min read
Your application starts but no RedisTemplate bean exists even though you think Redis is configured. How do you find out why?
ScenarioIntermediate6 min read
A service on Boot 3 starts with 450 auto-configuration candidates and takes 25 seconds. Using the condition evaluation report, how would you trim what is configured?
ScenarioAdvanced5 min read
Incidents show that services behave differently in production because an auto-configuration silently activated or backed off after a dependency change. What fleet-wide practice would you introduce to catch this before deploy?

Overriding and excluding auto-configuration

CodingFoundations5 min read
Show two ways to disable DataSourceAutoConfiguration in a Spring Boot application.
ScenarioIntermediate6 min read
A developer defines a custom ObjectMapper bean to add one module, and other teams report that spring.jackson.* properties stopped working and JSON dates changed format. What would you advise in the code review?
LeadershipPrincipal5 min read
Boot 4 modularises its auto-configuration into smaller technology-specific modules. As an architect for a large estate, how would you plan for such structural changes in a framework you depend on?

Writing a custom starter

DesignIntermediate6 min read
Design an internal starter that configures an audit client for all services. Describe the modules, the auto-configuration class, properties and how you would test it.
DesignAdvanced6 min read
Should an internal platform starter enforce security and logging settings that teams cannot override, or only provide defaults? How would you decide?
LeadershipAdvanced5 min read
Your platform team maintains 15 internal starters used by 200 services. Teams complain about surprises after upgrades. What governance would you put around internal starters?
LeadershipPrincipal5 min read
A platform group proposes replacing Spring Boot auto-configuration with an in-house framework of explicit wiring to remove 'magic'. How would you evaluate this build-versus-adopt decision over a five to ten year horizon?