title: Read an environment variable from applicationContext.xml
body: <p>I need read an environment variable defined in my web.xml</p>
  
  <pre><code>&lt;env-entry&gt;
      &lt;description&gt;Path Repositorio NFS&lt;/description&gt;
      &lt;env-entry-name&gt;PATH_ENV&lt;/env-entry-name&gt;
      &lt;env-entry-type&gt;java.lang.String&lt;/env-entry-type&gt;
      &lt;env-entry-value&gt;C:/V3&lt;/env-entry-value&gt;
  &lt;/env-entry&gt;
  </code></pre>
  
  <p>from my <code>applicationContext.xml</code></p>
  
  <pre><code>&lt;bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"&gt;
          &lt;property name="location" value="${PATH_ENV}/myprop.properties" /&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>How can I do this ?</p>
  
  <hr>
  
  <p>Finally I have done the next:</p>
  
  <p>1 Define environment variable in context.xml:</p>
  
  <pre><code>&lt;Environment name="PATH_ENV" type="java.lang.String"/&gt;
  </code></pre>
  
  <p>2 Define env-entry in web.xml</p>
  
  <pre><code>&lt;env-entry&gt;
      &lt;description&gt;Path Repositorio NFS&lt;/description&gt;
      &lt;env-entry-name&gt;PATH_ENV&lt;/env-entry-name&gt;
      &lt;env-entry-type&gt;java.lang.String&lt;/env-entry-type&gt;
      &lt;env-entry-value&gt;/WEB-INF/&lt;/env-entry-value&gt;
    &lt;/env-entry&gt;
  </code></pre>
  
  <p>3 Define in applicationContext.xml</p>
  
  <pre><code>&lt;bean id="configurationPath" class="org.springframework.jndi.JndiObjectFactoryBean"&gt;  
      &lt;property name="jndiName"&gt;  
          &lt;value&gt;java:comp/env/PATH_ENV&lt;/value&gt;  
      &lt;/property&gt;  
  &lt;/bean&gt;  
  
  &lt;bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"&gt;
         &lt;property name="location"&gt;
              &lt;bean factory-bean="configurationPath" factory-method="concat"&gt;
                  &lt;constructor-arg value="myprop.properties"/&gt;
              &lt;/bean&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
  </code></pre>
  
  <p>This is run correctly, However if I define a full path in:</p>
  
  <pre><code>&lt;env-entry-value&gt;C:/V3/&lt;/env-entry-value&gt;
  </code></pre>
  
  <p>I have the next problem:</p>
  
  <pre><code>java.io.FileNotFoundException: Could not open ServletContext resource [/C:/V3/aesantasa.properties]
  </code></pre>
  
  <p>I cant define a full path in env-entry-value Why?</p>