Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Repair Windows errors before they cause bigger problemsFix Now →Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
@ConfigurationProperties is usually the better choice when several related Spring Boot settings form a coherent object; use @Value for a small number of isolated values or when you genuinely need SpEL expressions. The practical decision depends on the shape of your configuration, relaxed-binding behavior, validation, metadata, and how the class is registered. This guide explains those trade-offs, with examples that apply to current Spring Boot documentation and notes for 3.5 applications.
At a glance
| Name | Best for | Key spec | Checked |
|---|---|---|---|
@ConfigurationProperties |
Grouped, hierarchical application settings | Strongly typed binding, relaxed naming, validation and metadata support | November 2026 |
@Value |
One-off values and expression-based injection | Placeholder injection with SpEL support; limited relaxed matching | November 2026 |
What is the main difference between @ConfigurationProperties and @Value?
@ConfigurationProperties maps a group of external properties into a dedicated, typed object. @Value injects individual values directly into fields, constructor parameters or methods. Spring Boot’s reference documentation explicitly recommends grouping a set of configuration keys for your own component in a POJO annotated with @ConfigurationProperties (Spring Boot externalized configuration reference).
As an Amazon Associate I earn from qualifying purchases.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Fix the driver behind crashes, sound loss and screen glitches3Clear out junk files and repair common Windows errorsThat recommendation is about maintainability, not a ban on @Value. A single timeout, feature switch or application name can be perfectly clear with @Value. As soon as settings have a shared prefix, nested structure, common validation rules or a lifecycle of their own, a properties class generally communicates intent better and avoids repeating placeholder strings throughout the codebase.
When should I use @ConfigurationProperties?
Choose it when the settings belong together and consumers should receive one configuration object. It is particularly useful for a hierarchy such as acme.client.base-url, acme.client.connect-timeout and acme.client.retry.max-attempts, or for a reusable library component whose configuration should be discoverable by IDEs.
Popular on Amazon
- 【90 Degree Full Function USB C Adapter】Supports the latest USB4 standard for up to 40Gbps of bandwidth, 8K video support, and up to 240W Fast charging; Support USB PD 3.1 Extended Power Range (EPR) including 140W, 180W and 240W. Your productivity is easily doubled. *Warm Tip: For the best fit, please make sure the USB-C port is fully exposed; thick or bulky cases may affect compatibility.
- 【Reliable Quality】Made from high-quality, scratch-resistant aluminum alloy, delicate metal frame. get excellent wear resistance and heat dissipation. Non-Slip Design for easier insertion and removal.
- 【Small and portable】Ultra thin size, ultra compact design, a petite physique that matches the minimalist design of your modern laptops. Coming with a slim figure that won't block the port next to the one it's plugged into.
- 【Compatibility】Widely work with most usb c, thunderbolt 4/3 devices. Compatibilit for ROG Ally, Steam Deck, Switch, MacBook Pro, Quest 3 VR headset, Surface Book 2, iPhone 18/17/16/15, Samsung Galaxy S23/S22/S21, Note 20/10, Google Pixel, ChromeBook, etc.
- 【Excellence Customer Support】If you experience any issues or cable failure, simply reach out to our dedicated customer service team. We provide a prompt response within 18 hours, providing you with the necessary technical support to resolve any concerns.
- Several related keys: one prefix gives the group a clear boundary.
- Nested configuration: objects and collections model the structure of YAML or properties files instead of flattening it into many fields.
- Type conversion: fields can represent durations, data sizes, lists, maps and other supported types rather than leaving conversion scattered through business code.
- Validation at startup: constraints can reject an invalid deployment before the application begins serving requests.
- Configuration metadata: the Spring Boot metadata system can describe keys and values to supported IDEs and tooling.
- Stable API for consumers: a service can accept one settings object, making dependencies explicit and simplifying tests.
For JavaBean-style binding, define a class with a lower-case kebab-case prefix and bind its properties through setters (or the documented mutable-object conventions). A minimal example is:
import java.time.Duration;
import org.springframework.boot.context.properties.ConfigurationProperties;
@ConfigurationProperties(prefix = "acme.client")
public class ClientProperties {
private String baseUrl;
private Duration connectTimeout = Duration.ofSeconds(2);
private int maxAttempts = 3;
public String getBaseUrl() {
return baseUrl;
}
public void setBaseUrl(String baseUrl) {
this.baseUrl = baseUrl;
}
public Duration getConnectTimeout() {
return connectTimeout;
}
public void setConnectTimeout(Duration connectTimeout) {
this.connectTimeout = connectTimeout;
}
public int getMaxAttempts() {
return maxAttempts;
}
public void setMaxAttempts(int maxAttempts) {
this.maxAttempts = maxAttempts;
}
}
The corresponding YAML keeps the hierarchy visible:
acme:
client:
base-url: https://api.example.test
connect-timeout: 3s
max-attempts: 4
When is @Value the better fit?
Use @Value when a value is genuinely local and isolated, or when the expression itself is part of the requirement. Typical examples include one feature flag used by one bean, a single directory path, or a value calculated with Spring Expression Language (SpEL).
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
@Component
public class BannerSettings {
private final String text;
public BannerSettings(
@Value("${app.banner-text:Welcome}") String text) {
this.text = text;
}
}
SpEL is the decisive capability that separates the two annotations. For example, @Value("#{systemProperties['user.timezone'] ?: 'UTC'}") is an expression evaluated by the container. Externalized values bound through @ConfigurationProperties are not evaluated as SpEL during configuration binding; the Spring Boot 3.5.16 API documents binding through setters or constructor parameters rather than expression evaluation (ConfigurationProperties API).
Do not select @Value solely because it is shorter. Ten short annotations can be harder to rename, validate and document than one properties object, especially when they all use the same prefix.
How does relaxed binding differ?
Spring Boot gives @ConfigurationProperties broad, documented relaxed-binding rules. A property can be written in forms appropriate to its source, while the Java field remains idiomatic camel case. The annotation prefix itself should use lower-case kebab case.
For a field named firstName under the prefix my.main-project.person, documented file forms include:
Also popular on Amazon
- 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
- Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
- Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
- HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
- What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
| Property source | Example spelling |
|---|---|
| Properties or YAML | my.main-project.person.first-name |
| Properties or YAML alternative | my.main-project.person.firstName |
| Properties or YAML alternative | my.main-project.person.first_name |
| Environment variable | MY_MAINPROJECT_PERSON_FIRSTNAME |
The exact transformation depends on the property source, so use lower-case kebab case in application.properties and YAML even when other spellings may bind. That convention gives predictable names for files, environment variables and generated metadata. See the relaxed-binding rules in the official reference for the source-specific details.
Does @Value support relaxed binding?
It has limited relaxed matching in Spring Boot, so the old blanket statement that @Value has no relaxed binding is too broad. The placeholder’s spelling matters. Use canonical kebab case in the placeholder:
@Value("${demo.item-price}")
private BigDecimal itemPrice;
With the documented rules, ${demo.item-price} can match demo.item-price and demo.itemPrice in an application properties file, and can match the environment form DEMO_ITEMPRICE. A camel-case placeholder such as ${demo.itemPrice} does not receive the same matching for the demo.item-price form. Therefore, even for one-off injection, write placeholders in lower-case kebab case.
This distinction becomes important during a migration. Renaming a key in a properties file may appear harmless while a camel-case @Value placeholder silently stops matching it. A canonical placeholder reduces that risk, but a grouped properties class is usually safer when many keys are being migrated together.
Which option provides stronger typing and validation?
@ConfigurationProperties provides the dedicated type-safe configuration feature set. Add @Validated to the properties type and Jakarta Bean Validation constraints to its fields. Use @Valid on a nested object when constraints inside that object must also be checked.
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Positive;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.validation.annotation.Validated;
@Validated
@ConfigurationProperties(prefix = "acme.client")
public class ClientProperties {
@NotBlank
private String baseUrl;
@Valid
private Retry retry = new Retry();
// getters and setters omitted
public static class Retry {
@Positive
private int maxAttempts = 3;
public int getMaxAttempts() {
return maxAttempts;
}
public void setMaxAttempts(int maxAttempts) {
this.maxAttempts = maxAttempts;
}
}
}
When the application starts, an invalid or missing value can fail configuration binding with a validation error rather than surfacing later as a failed request. This is especially valuable for credentials, endpoint URLs, limits and required operational settings.
@Value can convert a placeholder to a target type, and a default can be supplied after a colon, but it does not provide the same configuration-properties metadata and validation model. If you need constraints on several values, moving them into one validated class usually makes the failure message and ownership clearer.
Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchPC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Also popular on Amazon
- Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
- Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
- Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
- Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
- What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
What does configuration metadata change?
The Spring Boot comparison table marks metadata support for @ConfigurationProperties, not for @Value. A properties class can therefore be documented with metadata (including descriptions and expected values) so supported IDEs can offer completion and explanations while someone edits application.yml or application.properties.
This is a team-scale benefit rather than a runtime feature. It helps operators discover the supported key names, reduces spelling errors and makes a library’s configuration contract visible without opening its source. An isolated @Value placeholder remains useful, but it does not automatically create the same discoverable configuration namespace.
How do I register a @ConfigurationProperties class?
The class must be registered through Spring Boot’s configuration-properties mechanism. The two documented approaches are scanning and explicit enabling.
Option 1: scan a package
import org.springframework.boot.context.properties.ConfigurationPropertiesScan;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
@ConfigurationPropertiesScan
public class Application {
}
Scanning looks for types annotated with @ConfigurationProperties in the application’s scan scope. You can specify base packages when the properties classes live outside the default package hierarchy.
Option 2: enable selected types
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Configuration;
@Configuration
@EnableConfigurationProperties(ClientProperties.class)
public class ClientConfiguration {
}
Explicit enabling is useful when you want a short, intentional list or are configuring a library module. Registering the annotation alone does not make an arbitrary class a bean through ordinary component scanning; the documented configuration-properties registration path must be used.
For a version-specific implementation, consult the reference matching the application. The Spring Boot 3.5 externalized-configuration reference covers registration, binding and constructor cases for that release line.
Should I use JavaBean binding or constructor binding?
Both styles are supported, but constructor-binding rules have changed across Spring Boot releases, so do not copy an example without checking your deployed version. JavaBean binding generally uses a no-argument constructor plus getters and setters. Constructor binding makes the object immutable and puts required values in the constructor contract.
Also popular on Amazon
- Portable and powerful USB-C HUB: BENFEI USB Type-C HUB, with super-soft and knot-free silicone woven design cable, meets most mobile office needs. Compact, lightweight, stylish, and powerful portable USB C Hub equipped with 1 x HDMI port, 1 x 100W charging, and 3 x USB ports. 18-month warranty, 24-hour response, to ensure you feel at ease when using our product.
- Design centered on comfort and reliability: Thanks to BENFEI's end-to-end in-house cable production capability, in-house PCBA and assembly capability, using the industry's most advanced silicone woven design and process, 20cm cable in length, no knots, super-soft, the HUB is easy to use in all scenarios: laptop, tablet, stand etc. Super-soft, 25000+ life cycles, to meet your daily carrying and office needs.
- 100W Charging: Support up to 90W USB C pass-through charging via Type-C port to keep your laptop powered. 10W is reserved for other interface operations. No data and video function on the Type-C port.
- 4K HDMI Display: The HDMI port supports media display at resolutions up to 4K 30Hz, keeping every incredible moment detailed and ultra vivid. Please note that the C port of the Host device needs to support video output.
- Transfer Files in Seconds: Transfer files and from your laptop at speeds up to 10 Gbps with USB A 3.2 port. Extra 2 USB A 2.0 ports are perfectly for your keyboards and mouse.
Current reference guidance describes these important cases:
Recommended Free Tools
- A single parameterized constructor can imply constructor binding.
- When there are multiple constructors, the intended constructor may need
@ConstructorBinding. - Java records can use constructor binding under the documented constructor rules.
- Constructor-bound types need to be enabled or scanned through the configuration-properties mechanism.
- They cannot be created through the regular
@Component,@Beanor@Importpath described for ordinary Spring beans. - Compilation may need parameter-name retention so Spring can identify constructor parameters.
These constraints are precisely why registration details should be verified against the project’s Spring Boot version. A class that worked under one release’s conventions may require a different annotation or registration arrangement after an upgrade.
An immutable record can be concise:
import java.time.Duration;
import org.springframework.boot.context.properties.ConfigurationProperties;
@ConfigurationProperties(prefix = "acme.client")
public record ClientProperties(String baseUrl, Duration connectTimeout) {
}
Use a mutable JavaBean when framework compatibility and straightforward defaults matter more than immutability. Use constructor binding when you want the complete configuration state established at creation time and your version’s registration rules are understood.
How should I choose for nested settings and collections?
Nested settings are a strong signal for @ConfigurationProperties. A nested class, list or map mirrors the external document and lets one component receive one coherent object.
acme:
client:
headers:
X-Region: eu-west
servers:
- https://one.example.test
- https://two.example.test
@ConfigurationProperties(prefix = "acme.client")
public class ClientProperties {
private Map<String, String> headers = new LinkedHashMap<>();
private List<URI> servers = new ArrayList<>();
// getters and setters
}
With @Value, each nested item would need its own placeholder and conversion logic, and the relationship among values would be spread across a consuming class. That can be acceptable for two independent values, but it becomes cumbersome as the hierarchy grows—the exact pain point called out by Spring Boot’s comparison guidance.
Free tools Windows power users keep installed
One-click scans. No signup required.
Can I use both annotations in one application?
Yes. They solve different problems and can coexist. Put a shared namespace such as acme.client in a validated ClientProperties object, then use @Value for a genuinely unrelated setting or a SpEL-derived value.
Avoid binding the same key through both styles merely because both are available. Duplicate injection creates two configuration contracts, makes renaming harder and can produce inconsistent defaults. Pick one owner for each setting, and pass the properties object to services that need several related values.
Also popular on Amazon
- 【Read before You Buy】 Note: This adapter is USB 2.0 version and cannot transmit HDM, VGA, or other video signals. Nevertheless, they are fully capable of charging devices,duplicating files, and can be seamlessly integrated with USB-C earphones, wireless network adapters, and SD card adapters.
- 【Easy to Use and Safe】Thanks to modern manufacturing techniques, we've made these adapters sufficiently compact so that they can remain inserted in your device without noticeable protrusion or inconvenience. This means you don't have to constantly plug and unplug them, reducing the likelihood of wear and misalignment, and making them more convenient to carry around.
- 【Reliable Quality】Engineered for enhanced durability, durable aluminum alloy shell material,get excellent wear resistance and heat dissipation,the male USB C and female USB connectors & the male USB and female USB C connectors are designed to be plugged and unplugged up to 20000 times. Provides data transfer, device charging, memory space expansion, and additional computer peripherals.
- 【Think more for you】Do you need to connect a USB-C-enabled device to an odd device that only has USB-A ports? Then these USB-A male to USB-C female adapters are made for you.Simply insert the adapter into the USB-A port on the device, and you can instantly connect your USB-C device to the device that originally didn't have the correct connection port.
- 【Trusted xiwxi Quality and Service】As a responsible brand seller, you will receive xiwxi's 12-month Quality assurance and lifetime friendly customer service, you're not just buying a product,you're investing in peace of mind with all-round quality and exceptional customer service.
What are the most common naming and binding mistakes?
- Using camel case in a
@Valueplaceholder. Write${demo.item-price}, not${demo.itemPrice}, when you want Spring Boot’s documented relaxed matching. - Putting an uppercase or underscore prefix in the annotation. Keep
@ConfigurationProperties(prefix = "my.main-project")in lower-case kebab case; environment-variable transformation happens at the source boundary. - Forgetting registration. An annotated type that is neither scanned nor enabled will not be bound through the configuration-properties path.
- Expecting SpEL in a properties object. Externalized values are not evaluated as
@Value-style expressions during configuration-properties binding. - Assuming validation is automatic. Add
@Validated, use supported Jakarta constraints and annotate nested members with@Validwhere required. - Copying constructor-binding examples across versions. Check the reference for the exact Boot release, especially after an upgrade.
- Relying on a mutable collection that is never initialized. Follow the version’s binding guidance for pre-initialized collections and nested objects, and give defaults deliberately.
What decision framework should a team use?
Ask these questions in order:
- Are there multiple keys with one domain or prefix? If yes, start with
@ConfigurationProperties. - Is the data hierarchical, a collection, or shared by several beans? If yes, use a properties object rather than repeating
@Value. - Must invalid values stop startup with field-level constraints? If yes, use
@ConfigurationPropertieswith validation. - Do IDE completion and documented configuration metadata matter? If yes, prefer
@ConfigurationProperties. - Is this one isolated value with no shared structure?
@Valueis reasonable. - Does the value require SpEL evaluation? Use
@Value, because configuration-properties binding does not evaluate those expressions. - Will names come from several property sources? Prefer canonical kebab-case keys and placeholders, then verify source-specific relaxed-binding rules.
This framework produces a practical default rather than an absolute rule: structure, validation and discoverability favor @ConfigurationProperties; isolation and expressions favor @Value.
How do I migrate repeated @Value fields to @ConfigurationProperties?
Start by inventorying the placeholders and grouping those that share a prefix or represent one component. Define a properties class, preserve the external key names in canonical kebab case, register the class, then inject the object into the component that previously held the fields.
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →- List every placeholder, including its default and target type.
- Choose a prefix such as
acme.clientand move related keys beneath it. - Create fields or constructor parameters with meaningful types and defaults.
- Add validation constraints for required values and ranges.
- Register the class with
@ConfigurationPropertiesScanor@EnableConfigurationProperties. - Replace the individual fields with one constructor parameter of the properties type.
- Run the application with representative file and environment-variable configuration, checking startup errors and generated metadata.
- Remove obsolete placeholders only after all consumers use the new object.
During the transition, keep the old and new names from silently diverging. A canonical kebab-case placeholder helps with individual values, but the final properties class should be the single source of truth for the grouped namespace.
Which annotation should I use in a new Spring Boot project?
Use @ConfigurationProperties by default for application-owned configuration groups, especially when you expect the group to grow. Use @Value for a genuinely isolated value or a SpEL expression. That split aligns with Spring Boot’s documented comparison: properties classes provide structured binding, relaxed naming, validation and metadata, while @Value provides convenient individual injection and SpEL.
Keep the property names in lower-case kebab case, register configuration-properties types explicitly or through scanning, and check constructor-binding details against the exact Spring Boot version in production. Those small conventions prevent most surprises when configuration moves between YAML, properties files and environment variables.
Further reading from the official documentation
- Spring Boot Externalized Configuration — relaxed binding, the
@ConfigurationPropertiesversus@Valuecomparison, registration and validation. - Spring Boot 3.5 Externalized Configuration — version-specific guidance for applications on the 3.5 line.
ConfigurationPropertiesAPI for Spring Boot 3.5.16 — binding contract and annotation details.
Frequently Asked Questions
Can @ConfigurationProperties read environment variables?
Yes. Spring Boot converts environment-variable names to the corresponding property form, such as MY_MAINPROJECT_PERSON_FIRSTNAME for a nested my.main-project.person.first-name property. The exact conversion follows the documented source-specific relaxed-binding rules.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Where should I put default values for configuration properties?
You can initialize mutable fields or provide constructor defaults, while a @Value placeholder can use the :default syntax. Keep defaults close to the properties contract and validate values that must be supplied by the deployment.
Why does my @ConfigurationProperties bean not appear in dependency injection?
The type probably was not registered through @ConfigurationPropertiesScan or @EnableConfigurationProperties, or it is outside the scan scope. Constructor-bound types also have registration restrictions that differ from ordinary component beans.
Can configuration properties contain a SpEL expression such as #{...}?
No, not in the @Value sense. Externalized values bound by @ConfigurationProperties are not evaluated as SpEL; use @Value when expression evaluation is an actual requirement.
Does changing a property from camel case to kebab case always preserve @Value binding?
Only when the placeholder uses the canonical kebab-case form and the source follows Spring Boot’s documented relaxed rules. A camel-case placeholder does not receive the same matching for a kebab-case property, so update the placeholder deliberately.

