title: Spring @Value annotation in @Controller class not evaluating to value inside properties file
body: <p>I am new to Spring and trying to inject a string with a value using the <code>@Value("${loginpage.message}")</code> annotation inside of a controller annotated with the <code>@Controller</code> annotation and the value of my string is being evaluated as the string <code>"${loginpage.message}"</code> and not what is inside my properties file.</p>
  
  <p>Below is my controller with the string 'message' that I want to inject.</p>
  
  <pre><code>@Controller
  public class LoginController extends BaseController {
      @Value("${loginpage.message}")
      private String message;
  
      @RequestMapping("/")
      public String goToLoginPage(Model model) {
          model.addAttribute("message", message);
  
          return "/login";
      }
  }
  </code></pre>
  
  <p>My application context looks like this: </p>
  
  <pre><code>&lt;context:property-placeholder location="classpath:properties/application.properties" /&gt;
  
  &lt;context:annotation-config /&gt;
  
  &lt;context:component-scan base-package="com.me.application" /&gt;
  </code></pre>
  
  <p>My properties file has the line:</p>
  
  <pre><code>loginpage.message=this is a test message
  </code></pre>
  
  <p>Spring must be picking up the value at some point because whenever I change <code>@Value("${loginpage.message}")</code> to a value not in the properties file like <code>@Value("${notInPropertiesFile}")</code>, I get an exception.</p>