I\'ve had this working in some other project before, I am just re-doing the same thing but for some reason it\'s not working. The Spring @Value
is not reading f
Please note that if you have multiple application.properties
files throughout your codebase, then try adding your value to the parent project's property file.
You can check your project's pom.xml
file to identify what the parent project of your current project is.
Alternatively, try using environment.getProperty()
instead of @Value
.
for Sprig-boot User both PropertyPlaceholderConfigurer and the new PropertySourcesPlaceholderConfigurer added in Spring 3.1. so it's straightforward to access properties file. just inject
Note: Make sure your property must not be Static
@Value("${key.value1}")
private String value;