| name | configuration |
| description | Type-safe validated configuration properties from application.yml. Use when adding any externalisable value. |
Skill: Configuration
When to load it: When adding any new configurable value or environment-specific
behaviour to a feature.
What This Skill Does
Produces type-safe, validated configuration properties bound from application.yml.
Enforces fail-fast validation at startup and keeps configurable values out of Java source.
Rules
- All configurable values go in
application.yml. Never hardcoded in Java source.
- Group related properties under a
@ConfigurationProperties class. Do not use @Value
for more than one related property.
- Validate at startup with
@Validated. Fail fast — a misconfiguration discovered at
runtime is worse than a failed startup.
- Provide sensible defaults for non-critical values. Do not require configuration for
things with an obvious default.
- Document each property in
application.yml with a comment.
Pattern
@ConfigurationProperties(prefix = "[feature]")
@Validated
public record [Feature]Properties(
@NotBlank String [requiredProperty],
@Min(1) @Max(100) int [boundedProperty],
@Positive double [positiveProperty]
) {}
[feature]:
[required-property]: [value]
[bounded-property]: 10
[positive-property]: 0.7
Register in Spring Boot:
@Configuration
@EnableConfigurationProperties([Feature]Properties.class)
public class [Feature]Config {}
Design Constraints
- Do not hardcode configurable values in Java source — always
application.yml
- Do not use
@Value when two or more related properties exist — use @ConfigurationProperties
- Do not skip
@Validated — startup validation is not optional
- Do not provide a default for required values — required means no default