title: java - Spring @Value annotation returns null
body: <p>I'm trying to take advantage of <code>@Value</code> annotation and auto-populate my string-variable from the properties file, but with no luck. Values are not being set and are <code>null</code>.</p>
  
  <p>Here is my configuration:</p>
  
  <p><strong>SendMessageController.java</strong></p>
  
  <pre><code>@RestController
  public class SendMessageController {
  
      @Value("${client.keystore.type}")
      private static String keystoreType;
  
      @RequestMapping(value = "/sendMessage", method = RequestMethod.POST)
      public ResponseEntity&lt;SendMessageResponse&gt; sendMessage(@Validated @RequestBody SendMessageRequest messageRequest) {
      .......
      }
  </code></pre>
  
  <p><strong>application.properties</strong></p>
  
  <pre><code>client.keystore.type=JKS
  </code></pre>
  
  <p><strong>rest-servlet.xml</strong></p>
  
  <pre><code>&lt;beans xmlns="http://www.springframework.org/schema/beans"
         xmlns:context="http://www.springframework.org/schema/context"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc"
         xsi:schemaLocation="http://www.springframework.org/schema/beans
  http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
  http://www.springframework.org/schema/context
  http://www.springframework.org/schema/context/spring-context-4.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd"&gt;
  
  
      &lt;context:component-scan base-package="org.example.controllers" /&gt;
  
      &lt;context:property-placeholder location="classpath:application.properties"/&gt;
  
      &lt;bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean"/&gt;
      &lt;mvc:annotation-driven /&gt;
  
  &lt;/beans&gt;
  </code></pre>
  
  <p>When I run my application and try to access <code>keystoreType</code> variable it is always <code>null</code>.
  What am I doing wrong?</p>