@ConfigurationProperties
The Spring Boot annotation that binds a group of properties sharing a prefix onto a typed class or record.
In more detail
Instead of reading strings in every method, the application receives one checked object with typed fields. Adding validation annotations rejects bad configuration at startup, so a broken deployment fails early. The prefix is part of the external contract.
Example
@ConfigurationProperties(prefix = "service") public record ServiceSettings(String name, int timeoutSeconds) { }Related terms
- application properties — Settings a Spring Boot application reads at startup from files such as application.properties, environment variables and command-line arguments.
- Jakarta Validation — The Jakarta standard for declaring input rules as annotations on fields, such as @NotBlank and @Positive, and checking them automatically.
- record (Java) — A compact Java class for plain data, declared with its components in one line, for which the compiler generates the fields, accessors, equals, hashCode and toString.
Taught in
- Configuration And Profiles — Modern Java: Virtual Threads & High-Throughput Services