title: messageSource is not being autowired by spring
body: <p>I am trying to get the message from my message properties file</p>
  
  <pre><code>&lt;bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource"&gt;
  &lt;property name="basenames"&gt;
  &lt;list&gt;
  &lt;value&gt;mymessage&lt;/value&gt;
  &lt;/list&gt;
  &lt;/property&gt;
  &lt;/bean&gt;
  
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.context.MessageSource;
  
  public class Test{
  
  @Autowired
      private MessageSource messageSource;
      public MessageSource getMessageSource() {
          return messageSource;
      }
      public void setMessageSource(MessageSource messageSource) {
          this.messageSource = messageSource;
      }
  
  public void draw()
      {
  
      System.out.println(this.messageSource.getMessage("name",null,"default",null));`enter code here`
      }}
  </code></pre>
  
  <p>in that i am getting null pointer exception</p>
  
  <p>but when i have changed the code and implemented the MessageSourceAware in test class then its working fine. evenafter when i removed the @autowired annotation and the bean id defination itself. </p>