spring-projects / spring-projects/spring-boot
Provide a configuration validation mechanism
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 81.5k
- Forks
- 42.7k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 65
Description
It would be nice if Spring Boot had a specific flag that would turn on extensive configuration validation, something similar to what we have with --debug (--config-validation?).
Let's say the user made a typo in a property or edited a file used by the config server with no assistance. If you know what you are looking for and the application starts and you have the actuator you can hit /application/configprops to see if the property has been bound properly. This works but we could do better.
The binding has already an option to fail if we are not able to bind a particular property (see @ConfigurationProperties#ignoreInvalidFields). One idea would be to have a mode where:
- This flag is turned on for everything
- For every failed attempt at binding a property we would keep a reference to the failure (rather than throwing an exception as this flag currently does)
- If there are some unbounded properties, throw an exception coupled with a
FailureAnalyzerthat provides a nice and readable report (We do have some concept of origin of the property in 2.0 so we should use that)
I am pretty convinced that turning on this mechanism on a perfectly valid application will generate false positive but we may find a way to mitigate that.
This issue related to #9936 and, IMO, should supersede it.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the existing --debug behavior, @ConfigurationProperties#ignoreInvalidFields, the /application/configprops endpoint, and the FailureAnalyzer concept. Review the relationship to issue #9936 and determine the validation scope, false-positive handling, failure collection, and readable error report needed for a complete design.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring-boot
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100