title: Spring placeholder inside location of PropertyPlaceholderConfigurer
body: <p>I'm trying to initialize PropertyPlaceholderConfigurer bean with 2 locations. First location has static value, pointing to property file. That file contains a path to dir with the second location. The structure of application context file is like below</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"&gt;
      &lt;bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"&gt;
          &lt;property name="locations"&gt;
              &lt;list&gt;
                  &lt;value&gt;file:C:/SpringTests/src/main/resources/file1.properties&lt;/value&gt;
                  &lt;value&gt;file:${file2.dir}file2.properties&gt;&lt;/value&gt;
              &lt;/list&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
  &lt;/beans&gt;
  </code></pre>
  
  <p>The question is, why placeholder <code>${file2.dir}</code> is not replaced by value from first properties file and how to fix the problem. Of course, there is such property inside first file.</p>
  
  <p>Content of file1.properties</p>
  
  <pre><code>file2.dir=C:/SpringTests/src/main/resources/
  </code></pre>
  
  <p>Stack trace</p>
  
  <pre><code>19-Sep-2016 07:12:23.761 SEVERE [RMI TCP Connection(3)-127.0.0.1] org.springframework.web.context.ContextLoader.initWebApplicationContext Context initialization failed
   org.springframework.beans.factory.BeanInitializationException: Could not load properties; nested exception is java.io.FileNotFoundException: ${file2.dir}file2.properties (Nie można odnaleźć określonego pliku)
      at org.springframework.context.support.PropertySourcesPlaceholderConfigurer.postProcessBeanFactory(PropertySourcesPlaceholderConfigurer.java:147)
      at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:694)
      at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:669)
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:461)
      at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:389)
      at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:294)
      at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
      at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4716)
      at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5178)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:152)
      at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:724)
      at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:700)
      at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
      at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1702)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:498)
      at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300)
      at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
      at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
      at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:482)
      at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:431)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:498)
      at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300)
      at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
      at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
      at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1468)
      at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:76)
      at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1309)
      at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1401)
      at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:829)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:498)
      at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:324)
      at sun.rmi.transport.Transport$1.run(Transport.java:200)
      at sun.rmi.transport.Transport$1.run(Transport.java:197)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
      at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:683)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      at java.lang.Thread.run(Thread.java:745)
  Caused by: java.io.FileNotFoundException: ${file2.dir}file2.properties (Nie można odnaleźć określonego pliku)
      at java.io.FileInputStream.open0(Native Method)
      at java.io.FileInputStream.open(FileInputStream.java:195)
      at java.io.FileInputStream.&lt;init&gt;(FileInputStream.java:138)
      at java.io.FileInputStream.&lt;init&gt;(FileInputStream.java:93)
      at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:90)
      at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:188)
      at org.springframework.core.io.UrlResource.getInputStream(UrlResource.java:125)
      at org.springframework.core.io.support.EncodedResource.getInputStream(EncodedResource.java:143)
      at org.springframework.core.io.support.PropertiesLoaderUtils.fillProperties(PropertiesLoaderUtils.java:98)
      at org.springframework.core.io.support.PropertiesLoaderSupport.loadProperties(PropertiesLoaderSupport.java:175)
      at org.springframework.core.io.support.PropertiesLoaderSupport.mergeProperties(PropertiesLoaderSupport.java:156)
      at org.springframework.context.support.PropertySourcesPlaceholderConfigurer.postProcessBeanFactory(PropertySourcesPlaceholderConfigurer.java:137)
      ... 51 more
  </code></pre>