Spring Boot application.properties @Value not populating
Codemia Knowledge Hub ·
When a value from application.properties (or application.yml) does not populate, the cause is usually a mismatched key, a file Spring Boot is not loading, the wrong active profile, bad placeholder syntax, a missing property, or an environment variable or command-line argument overriding it. Check those in that order.
How Spring Boot resolves properties
Spring Boot resolves values through @ConfigurationProperties, @Value, the Environment and Binder:
@Value: Injects a property value into a field, typically with@Value("${property.key}").@ConfigurationProperties: Binds a class to a prefix in the properties file for type-safe config.- Profiles: Different configurations per environment, usually in
application-{profile}.properties.
Reasons a property is not populated
1. Typo in the property key
The key in application.properties must match exactly what your code references with @Value or @ConfigurationProperties.
2. Property file not loaded
The file might not be loaded, especially if you use spring.config.location or similar mechanisms. Check the project structure and make sure application.properties is under resources:
3. Wrong active profile
With multiple profiles, make sure the active profile is set correctly:
Then confirm the matching application-{profile}.properties file is the one being loaded.
4. Placeholder syntax errors
A common mistake is writing ${propertykey} instead of ${property.key}.
5. Property not defined
An unresolved placeholder can mean the property is not defined in the file or the environment. Provide a default value:
6. Case sensitivity
Property keys are case-sensitive, so check the casing.
7. Environment overrides
OS environment variables and command-line arguments can override properties. Check whether any are set and causing unexpected values.
Debugging property values
Log the values at startup
Inject the value into a component and log it:
If the logged value is null or wrong, check whether it is injected and populated at the right lifecycle stage.
Look for command-line overrides
Command-line arguments take priority over application.properties, so a flag you forgot about will win:
Example application.properties
Quick reference
| Potential Issue | Description | Solution |
| Typo in Property Key | The key is mistyped in code or properties file. | Correct by cross-checking property keys. |
| Incorrect Property File | File is not in the correct location or not named properly. | Confirm file location and name. |
| Profile Misconfiguration | Incorrect profile is active or not set. | Set the correct profile using spring.profiles.active. |
| Syntax Errors | Wrong placeholder syntax. | Correct placeholder syntax to ${property.key}. |
| Property Not Defined | Placeholder value missing from properties. | Define property or provide a default value. |
| Case Sensitivity | Mismatch in property key casing. | Ensure matching casing in properties key and reference. |
| Environment Overrides | Environment variables or CLI arguments override properties. | Check and adjust CLI arguments/environment settings. |
Related reading
- Spring boot applications consume 100 CPU at startup
- Spring Boot Async method in controller is executing synchronously
- Spring Boot Async method not running in separate Thread
- Spring Boot Authentication for Integration Tests
- Spring Boot Cannot access REST Controller on localhost 404
- Spring Boot ClassNotFoundException org.springframework.core.metrics.ApplicationStartup
- Spring Boot auto configuration for datasource
- Spring Boot auto configuration of Kafka Producers with multiple De-Serializer types
System design interview problems on this topic
- Design an API Rate Limiter: solution and walkthrough
- Design a Distributed Messaging System: solution and walkthrough
- Design an Online Payment Service: solution and walkthrough
- Design a Key Value Store: solution and walkthrough

OOD Fundamentals
Master object-oriented design from first principles, SOLID, design patterns, and classic interview problems with hands-on coding.
View the courseData Structures & Algorithms practice on Codemia
Step through 300+ coding interview problems with animated visualisers that show the data structure changing as the code runs. The Blind 75 are free.