title: Spring can't inject property value using Value annotation
body: <p>I'm using Spring MVC and i can't inject property value using <code>@Value</code> annotation in my controller class. Here is my controller:</p>
  
  <pre><code> @Controller
      public class MailController {
          @Value("${mail.server.username}")
          private String destinationEmail;
          ...
          }
  </code></pre>
  
  <p>And here is my application context xml file:</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"
         xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
         xmlns:util="http://www.springframework.org/schema/util"
         xmlns:p="http://www.springframework.org/schema/p"
         xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"&gt;
  
      &lt;context:component-scan base-package="org.content.stream"&gt;
          &lt;context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/&gt;
      &lt;/context:component-scan&gt;
  
      &lt;!--&lt;context:property-placeholder location="classpath:content-stream.properties" /&gt;--&gt;
  
      &lt;bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"
            p:location="classpath:content-stream.properties" name="propertyPlaceholderConfigurer"/&gt;
  
      &lt;import resource="security.xml" /&gt;
  
      &lt;bean id="messageSource"
            class="org.springframework.context.support.ResourceBundleMessageSource"&gt;
          &lt;property name="basenames"&gt;
              &lt;list&gt;
                  &lt;value&gt;mymessages&lt;/value&gt;
              &lt;/list&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
  
      &lt;bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"&gt;
          &lt;property name="driverClassName" value="${dataSource.driverClassName}" /&gt;
          &lt;property name="url" value="${dataSource.url}" /&gt;
          &lt;property name="username" value="${dataSource.username}" /&gt;
          &lt;property name="password" value="${dataSource.password}" /&gt;
      &lt;/bean&gt;
  
      &lt;bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"&gt;
          &lt;property name="dataSource" ref="dataSource"/&gt;
          &lt;property name="packagesToScan" value="org.content.stream.entities"/&gt;
          &lt;property name="hibernateProperties"&gt;
              &lt;props&gt;
                  &lt;prop key="hibernate.dialect"&gt;${hibernate.dialect}&lt;/prop&gt;
                  &lt;prop key="show_sql"&gt;${hibernate.show_sql}&lt;/prop&gt;
                  &lt;prop key="hibernate.hbm2ddl.auto"&gt;${hibernate.hbm2ddl.auto}&lt;/prop&gt;
              &lt;/props&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
  
      &lt;tx:annotation-driven transaction-manager="transactionManager"/&gt;
  
      &lt;bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager"&gt;
          &lt;property name="dataSource" ref="dataSource" /&gt;
          &lt;property name="sessionFactory" ref="sessionFactory" /&gt;
      &lt;/bean&gt;
  
      &lt;bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"&gt;
          &lt;property name="maxUploadSize" value="50000000"/&gt;
      &lt;/bean&gt;
  
      &lt;bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl"&gt;
          &lt;property name="host" value="${mail.server.host}" /&gt;
          &lt;property name="port" value="${mail.server.port}" /&gt;
          &lt;property name="username" value="${mail.server.username}" /&gt;
          &lt;property name="password" value="${mail.server.password}" /&gt;
          &lt;property name="javaMailProperties"&gt;
              &lt;util:properties location="classpath:javamail.properties" /&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
  
      &lt;bean id="destinationEmail" class="java.lang.String"&gt;
          &lt;constructor-arg value="${mail.server.username}"/&gt;
      &lt;/bean&gt;
  
      &lt;bean id="templateMailMessage"
            class="org.springframework.mail.SimpleMailMessage"&gt;
          &lt;property name="text"&gt;
              &lt;value&gt;
                  &lt;![CDATA[
              Уважаемый, %s!
              Содержымое : %s
              С уважением %s !
              ]]&gt;
              &lt;/value&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
  
  &lt;/beans&gt;
  </code></pre>
  
  <p>I read many answers on stack but in my case nothing to work. Content of my propery file:</p>
  
  <pre><code>...
  #Mail properties
  mail.server.host=smtp.gmail.com
  mail.server.port=587
  mail.server.username=myemail@gmail.com
  mail.server.password=password
  </code></pre>