Externalized configuration
21 questions in 7 subtopics.
Property source precedence
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.Production uses a value for payment.timeout that nobody can find in any file. How would you find where it comes from?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?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
Write a singleapplication.yml that sets logging to INFO by default and DEBUG when the dev profile is active. How do you activate the profile?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?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
When would you use@Value and when @ConfigurationProperties? List the differences.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.A property timeout: 5000 bound to a Duration field in @ConfigurationProperties results in 5 seconds in one service and 5000 seconds in another. Why?Design the configuration conventions for 100 services: property prefixes, typed properties, defaults and documentation. What would you require from every team?Relaxed binding
How do you set the propertyspring.datasource.hikari.maximum-pool-size from an environment variable, and how do you set the second element of a list property my.servers?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
How do you make startup fail when the required propertypayments.api-url is missing or not a valid URL?How would you standardise configuration validation across all services so that misconfiguration is found before deploy?Config import and config trees
What doesspring.config.import do? Give examples with optional:, file: and configtree:.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?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
Describe the options for supplying database passwords to a Spring Boot service in production and their trade-offs.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?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?No question matches these choices.