title: Unable to resolve placeholder in string value
body: <p>In one of the services in my Spring project, I have this:</p>
  
  <pre><code>@Value("${myProject.myVar}")
  private int myVar;
  </code></pre>
  
  <p>This is meant to reference a value in a file called <code>application.properties</code> which is sitting in my <code>ProjectRoot/src/main/java</code> folder. That file looks something like this:</p>
  
  <pre><code>myProject.myVar = 6
  </code></pre>
  
  <p>I also have a config file <code>ProjectRoot/WebContent/WEB-INF/spring/servlet-context.xml</code> which contains this line:</p>
  
  <pre><code>&lt;context:property-placeholder location="classpath:application.properties" /&gt;
  </code></pre>
  
  <p>When I run the project, I see the following which seems to indicate that the file is being loaded properly:</p>
  
  <pre><code>INFO : org.springframework.context.support.PropertySourcesPlaceholderConfigurer -     
  Loading properties file from class path resource [application.properties]
  </code></pre>
  
  <p>However, my program then crashes with this nested exception:</p>
  
  <pre><code>Could not autowire field: private int     
  org.myproject.service.MyServiceImpl.myVar; nested 
  exception is java.lang.IllegalArgumentException: Could not resolve placeholder 
  'myProject.myVar' in string value "${myProject.myVar}"
  </code></pre>
  
  <p>What gives?</p>
  
  <p><strong>Edit: <code>web.xml</code></strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns="http://java.sun.com/xml/ns/javaee" 
      xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
      xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
          http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
      id="WebApp_ID" 
      version="3.0"&gt;
      &lt;display-name&gt;Test&lt;/display-name&gt;
  
      &lt;context-param&gt;
          &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
          &lt;param-value&gt;
              /WEB-INF/spring/root-context.xml
              /WEB-INF/spring/spring-security.xml
              /WEB-INF/spring/servlet-context.xml
          &lt;/param-value&gt;
      &lt;/context-param&gt;
  
      &lt;listener&gt;
          &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt;
      &lt;/listener&gt;
  
      &lt;servlet&gt;
          &lt;servlet-name&gt;appServlet&lt;/servlet-name&gt;
          &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
          &lt;init-param&gt;
              &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
              &lt;param-value&gt;/WEB-INF/spring/servlet-context.xml&lt;/param-value&gt;
          &lt;/init-param&gt;
          &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
      &lt;/servlet&gt;
  
      &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;appServlet&lt;/servlet-name&gt;
          &lt;url-pattern&gt;/&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
  
      &lt;filter&gt;
          &lt;filter-name&gt;CORS&lt;/filter-name&gt;
          &lt;filter-class&gt;com.thetransactioncompany.cors.CORSFilter&lt;/filter-class&gt;
      &lt;/filter&gt;
      &lt;filter-mapping&gt;
          &lt;filter-name&gt;CORS&lt;/filter-name&gt;
          &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
      &lt;/filter-mapping&gt;
  
      &lt;filter&gt;
          &lt;filter-name&gt;springSecurityFilterChain&lt;/filter-name&gt;
          &lt;filter-class&gt;
              org.springframework.web.filter.DelegatingFilterProxy&lt;/filter-class&gt;
      &lt;/filter&gt;
  
      &lt;filter-mapping&gt;
          &lt;filter-name&gt;springSecurityFilterChain&lt;/filter-name&gt;
          &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
      &lt;/filter-mapping&gt;
  
      &lt;error-page&gt;
          &lt;error-code&gt;404&lt;/error-code&gt;
          &lt;location&gt;/WEB-INF/views/errors/error.jsp&lt;/location&gt;
      &lt;/error-page&gt;
  &lt;/web-app&gt;
  </code></pre>