I am trying to load a property file from an environment variable, so here's what I tried:
<bean id="propertyPlaceholderConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:messages/application.properties</value>
<value>file:${My_ENV_VAR}/*.properties</value>
</list>
</property>
<property name="ignoreResourceNotFound" value="true" />
<property name="searchSystemEnvironment" value="true" />
<property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE" />
</bean>
I have a new environment variable named My_ENV_VAR=C:\Program Files\My Folder\props.properties
but when stopping and starting the application the value of the variable is not set, any ideas why?
UPDATE: Requirement
I want to read the hibernate properties (url,username,password) in the applicationContext.xml from an external property file on file system, which its path is stored in an environment variable.