I\'m using spring with my application, and I\'m able to inject some properties from some file on a class path into my app and everything works perfectly. i.e.
&
I had a similar problem sometime back. My requirement was the the property files is not bundled inside the application (and hence not in classpath). The file could be at any location in file system. Here is how I solved it,
I am reusing your example
<bean class="org.springframework.web.context.support.ServletContextPropertyPlaceholderConfigurer">
<property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE" />
<property name="searchContextAttributes" value="true" />
<property name="contextOverride" value="true" />
<property name="ignoreResourceNotFound" value="true" />
<property name="locations">
<list>
<value>file://${APP_PROP_HOME}/application.properties</value>
</list>
</property>
</bean>
The Spring resolves ${APP_PROP_HOME} to the value stored in corresponding env property and your application is configured at runtime.
If I am reading your question correctly, You want to use an external properties file(i.e File is not in the application runtime class path). If that is the case you need to use the file tag
<value>file:///c:\application.properties</value>
You can use @Value
to inject values from the env. Example:
private someFoo;
@Value("${systemProperties.someFoo}")
public void setSomeParam(String someParam) {
this.someFoo = someParam;
}