Scrivio Interview library

Externalized configuration

21 questions in 7 subtopics.

Property source precedence

ConceptFoundations6 min read
server.port is set to 8081 in application.yml in the jar, to 8082 by the SERVER_PORT environment variable, and to 8083 with --server.port on the command line. Which value wins and why? Name the general precedence order.
DebuggingIntermediate6 min read
Production uses a value for payment.timeout that nobody can find in any file. How would you find where it comes from?
LeadershipPrincipal6 min read
Configuration changes cause a large share of production incidents in your company. As the senior technical leader, how would you treat configuration over the long term so that it is as safe as code?
LeadershipPrincipal6 min read
Twelve-factor guidance says configuration belongs in the environment, while many organisations now use central configuration servers and GitOps. How would you choose an approach for a large organisation, and what risks do you watch?

Application.yml and profiles

CodingFoundations6 min read
Write a single application.yml that sets logging to INFO by default and DEBUG when the dev profile is active. How do you activate the profile?
ScenarioIntermediate6 min read
A codebase has profiles dev, qa, stage, prod, eu, us, kafka, nokafka and more, combined in different ways per environment. Bugs come from unexpected combinations. How would you simplify?
LeadershipPrincipal6 min read
Profiles were once the main way to configure Spring applications per environment, and many organisations now avoid environment profiles in favour of deployment-time configuration. What would you recommend for the next decade and why?

@ConfigurationProperties

ConceptFoundations5 min read
When would you use @Value and when @ConfigurationProperties? List the differences.
CodingFoundations6 min read
Bind the properties mail.host, mail.port and mail.retry.max-attempts to an immutable Java object. Show the class and how it is registered.
DebuggingIntermediate5 min read
A property timeout: 5000 bound to a Duration field in @ConfigurationProperties results in 5 seconds in one service and 5000 seconds in another. Why?
DesignAdvanced6 min read
Design the configuration conventions for 100 services: property prefixes, typed properties, defaults and documentation. What would you require from every team?

Relaxed binding

ConceptFoundations5 min read
How do you set the property spring.datasource.hikari.maximum-pool-size from an environment variable, and how do you set the second element of a list property my.servers?
DebuggingIntermediate5 min read
A map property in YAML, routes: {"/api/v1": a}, binds with key apiv1 instead of /api/v1. Why, and how do you keep the special characters?

Validating configuration

CodingFoundations6 min read
How do you make startup fail when the required property payments.api-url is missing or not a valid URL?
DesignAdvanced6 min read
How would you standardise configuration validation across all services so that misconfiguration is found before deploy?

Config import and config trees

ConceptFoundations6 min read
What does spring.config.import do? Give examples with optional:, file: and configtree:.
ScenarioIntermediate6 min read
Kubernetes mounts secrets as files under /etc/secrets/db/username and /etc/secrets/db/password. How would you make them available as db.username and db.password in Spring Boot?
ScenarioAdvanced6 min read
Half of your services read configuration from Spring Cloud Config and half from Kubernetes ConfigMaps. A central config server outage once blocked all deploys. How would you choose a single approach and migrate?

Managing secrets

DesignIntermediate7 min read
Describe the options for supplying database passwords to a Spring Boot service in production and their trade-offs.
LeadershipAdvanced6 min read
An audit finds secrets in Git history in 40 repositories and in plain environment variables across the fleet. How do you set and roll out a secrets standard?
LeadershipPrincipal6 min read
Your company plans to move from long-lived database passwords in configuration to short-lived, identity-based credentials over several years. How would you plan this, and what risks would you manage?