title: Injecting ResourceBundle in Spring Bean
body: <p>I want to inject a resource bundle into a bean. I need the resourcebundle, I can't get the messages directly. I am using this snippet to load the resource:</p>
  
  <pre><code> &lt;bean id="reportMessages" class="org.springframework.context.support.ResourceBundleMessageSource"&gt;
          &lt;property name="basename"&gt;
              &lt;value&gt;report.messages&lt;/value&gt;
          &lt;/property&gt;
  </code></pre>
  
  <p>Then I can inject it into my bean like this:</p>
  
  <pre><code>@Autowired
  @Qualifier("reportMessages")
  private ResourceBundleMessageSource reportMessages;
  </code></pre>
  
  <p>But this gives me a ResourceBundleMessageSource, which has a getResourceBundle() method which is protected and thus I can't call it.</p>
  
  <p>I.e. what I want is Spring's built-in functionality to read a Message Bundle depending on locale, and then treat it as a separate bean.</p>