Hi I'm using Spring PropertyPlaceholderConfigurer to fetch values from a properties file.
It's working when i get the value in xml. but in a java class
@Value("${application.imagesPath}")
private String imagesPath;
Returns the literal value "${application.imagesPath}" even though when running the server if the variable application.imagesPath is not in the properties file i get the error
Could not autowire field: private java.lang.String com.ymobility.filltrack.controller.ApiController.imagesPath; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'application.imagesssPath' in string value
(the typo imagesssPath is on purpose to show that if i misspell it, it is knowing that the property doesn't exist which indicates that it is actually reading the properties file correctly, my issue is when there is no error, the value retrieved is the literal string "${application.imagesPath}" instead of it's value in properties file)
So the controller is actually getting the value from the properties file, but the value of the string when used is still the literal value "${application.imagesPath}".
My context.xml file contains the following config
<bean id="appProperties"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>/WEB-INF/properties/app.properties</value>
</list>
</property>
</bean>
The class I'm using has the following annotations
@RestController
@RequestMapping("/api")
Any idea what might be the problem ?
Thanks