title: Moving messageSource to applicationContext causes the default messageSource not to be visible in dispatcher-servlet context
body: <p>I have a webapp in which I define the basic <code>dispatcher-servlet</code> context in web.xml and it loads the <code>applicationContext</code>.</p>
  
  <p>I had <code>messageSource</code> defined in <code>dispatcher-servlet</code> and was injecting it to controllers fine.</p>
  
  <p>I also have my services defined in <code>applicationContext</code> and I can inject them into my controllers (defined in <code>dispatcher-servlet</code> context).</p>
  
  <p>But when I moved my definition for <code>messageSource</code> to the <code>applicationContext</code> so that some services could resolve messages the <code>dispatcher-servlet</code> context shows that it's not finding a <code>messageSource</code> bean and is using the default, thus the controllers get the wrong bean injected.</p>
  
  <p>Any idea why the messageSource definition in <code>applicationContext</code> wouldn't be visible to the <code>dispatcher-servlet</code> context?
  <br><br>
  <hr>
  I see that my messageSource bean is loaded in the <code>applicationContext</code> section of the logs:</p>
  
  <pre><code>2058 [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory  - Creating shared instance of singleton bean 'messageSource'
  2058 [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory  - Creating instance of bean 'messageSource'
  ...
  2082 [main] DEBUG org.springframework.web.context.support.XmlWebApplicationContext  - Using MessageSource [mycommons.spring.ResourceBundleMessageSourceWithDefaultResolution: basenames=[messages]]
  </code></pre>
  
  <p><br>
  I see this log in the loading of <code>dispatcher-servlet</code>:</p>
  
  <pre><code>3858 [main] DEBUG org.springframework.web.context.support.XmlWebApplicationContext  - Unable to locate MessageSource with name 'messageSource': using default [org.springframework.context.support.DelegatingMessageSource@55611ed3]
  </code></pre>