Scrivio Interview library

Configuration, environment and profiles

24 questions in 6 subtopics.

@Value

ConceptFoundations6 min read
What is the difference between ${...} and #{...} in a Spring @Value annotation? Give examples with default values.
DebuggingFoundations7 min read
A @Value field is null at runtime. List the common causes.
DesignIntermediate6 min read
When would you use @ConfigurationProperties instead of @Value, and why?

Environment and PropertySources

ConceptFoundations5 min read
What is the Spring Environment, and in what order does Spring Boot resolve a property defined in several places?
CodingIntermediate7 min read
How would you add a custom PropertySource, for example values read from an internal secrets service, before the application context is created?
DebuggingIntermediate6 min read
An environment variable APP_FEATURE_ENABLED=true does not override app.feature-enabled=false from application.yml in production. How would you investigate?
DesignAdvanced6 min read
Design how configuration should be managed for 100 services across development, staging and production.
LeadershipPrincipal6 min read
Configuration errors cause a large share of your production incidents. What long-term strategy would you set for configuration management across the company?

Profiles

ConceptFoundations5 min read
How do Spring profiles work, and how do you activate them in Spring Boot?
CodingFoundations5 min read
In a single application.yml, how do you set a property only when the 'prod' profile is active?
ScenarioIntermediate6 min read
A codebase has profiles dev, test, qa, staging, prod, prod-eu, prod-us and local-docker, and nobody knows which beans are active where. How would you simplify it?
LeadershipPrincipal6 min read
Over a decade, many organisations have moved from environment-specific builds and profiles to externalised configuration and feature flags. Explain why, and what governance you would set today.

@Conditional

ConceptFoundations5 min read
What does the @Conditional annotation do, and name four common Spring Boot conditions.
InternalsIntermediate5 min read
Why does the Spring Boot documentation say @ConditionalOnBean and @ConditionalOnMissingBean are reliable only in auto-configuration classes?
DebuggingIntermediate6 min read
An auto-configured bean you expected is missing, or your own bean is ignored. How do you find out which conditions matched?
DesignAdvanced6 min read
You are writing an internal Spring Boot starter for your company's messaging client. How would you use conditions so it works safely across many services?
ScenarioPrincipal6 min read
Your internal starters have grown to hundreds of conditions, and nobody can predict which beans a service gets. How would you bring this under control over the next few years?

SpEL

CodingFoundations6 min read
Write SpEL expressions that (1) call a static method, (2) reference another bean's property, and (3) use a safe navigation and default value.
ConceptIntermediate6 min read
Where does Spring use SpEL besides @Value, and what problems does putting logic in SpEL cause?
ScenarioAdvanced7 min read
A security review finds that your application evaluates SpEL expressions built from request parameters for dynamic filtering. What is the risk and how do you fix it?

@Import and configuration composition

ConceptFoundations6 min read
What does @Import do, and what kinds of classes can it import?
InternalsIntermediate6 min read
How does Spring Boot find and load auto-configurations, and how does DeferredImportSelector fit in?
DesignAdvanced6 min read
How would you structure configuration in a large modular monolith so that each module owns its beans and the application composes them explicitly?
LeadershipPrincipal6 min read
Spring configuration moved from XML to Java configuration to Boot auto-configuration. What are the long-term costs of auto-configuration for a large organisation, and how do you manage them?