A non-optional configtree location prevents the checked Boot child from starting when its directory is absent.
Spring Boot required configtree: reject an absent directory
Fail on the location
The test writes spring.config.import=configtree: followed by an absolute path to absent-values/. It never creates that directory. The child exits nonzero and never prints a bound batch. A default batch value exists in the probe, but it cannot make a required source appear. The successful file-tree case creates the directory and its two value files.
If an operator promises to supply a directory, a required import turns a missing mount path into an immediate startup failure. An optional prefix is appropriate only when the application has a documented fallback for the entire directory. The optional file fixture uses that different policy.
Directory presence is only the first check
A directory can exist while an individual required key is missing or invalid. The probe’s defaults mean a missing batch-size file could leave batch 8 in place. Stronger deployment contracts should validate required keys explicitly and test missing-file cases. The invalid-value test proves only one bound range rejection.
This is a local directory, not a container mount with platform permissions, rotation or availability guarantees.
Checked source
spring.config.import=configtree:/absolute/path/absent-values/
# Required directory is absent; the child exits nonzero.Verification boundary
RelaySettingsProcessTest.missingRequiredFileTreeStopsStartup. The full fixture is in the downloadable source kit.
Common Mistakes
- Do not assume a default value rescues a missing required import.
- Do not treat directory presence as proof that every required file exists.
- Do not make every deployment source optional to avoid startup failures.
Read next
Spring Boot configtree: bind one file per property in a child JVM, Spring Boot configtree validation: reject a present but unsafe value, Spring Boot config import: fail startup when a required file is missing, Spring Boot file-tree tests: prove binding without claiming secret delivery.
