Typed configuration groups related external settings. Validate required values and ranges so incorrect deployment configuration fails clearly.
Before you start
You should know Java classes, dependency injection and basic HTTP requests. Identify where a call crosses a framework-managed boundary. The snippets illustrate a focused mechanism; database configuration, application wiring and authentication must be supplied by the surrounding application when applicable.
The practical goal is to reason through this situation: A payment client configuration holds base URL and timeout with constraints. Read the walkthrough first, then try the interview exercise before opening its answer. The important part is explaining the decision and its consequences, rather than remembering a definition alone.
Step-by-step walkthrough
Step 1: Group related settings
Model endpoint and timeout as one typed configuration contract.
Step 2: Validate startup input
Reject missing mandatory settings and invalid ranges before requests arrive.
Step 3: Choose intentional defaults
Require secrets explicitly and avoid printing them in failure diagnostics.
Worked scenario
A payment client configuration holds base URL and timeout with constraints.
A payment timeout of zero or a malformed base URL should fail configuration validation rather than causing confusing behavior on the first purchase. Use safe documented defaults only when omission has a sensible meaning. External configuration still needs correct binding and validation activation in the application.
Common mistake
Unvalidated strings can move configuration failures into the first production request.
Verify the behavior
Start with missing, invalid and valid settings; confirm failure messages name fields without revealing secrets.
Interview exercise
Choose sensible defaults.
Answer and reasoning
Use documented safe defaults where appropriate and require deployment-specific secrets explicitly without exposing them in diagnostics.
Continue learning
Compare the scenario with the Spring Boot interview questions and test your understanding with the Spring Boot MCQs. For terminology and implementation details, consult the reference material.