title: Spring's messageResource implicitly localized from Session - not having to pass Locale reference
body: <p>I'm wondering, what is the best way of having something like prototype of messageResource (could be singleton too I guess) created for each request and populated with request's Locale or Locale gotten from User object in the session. So that one doesn't have to pass Locales around, which is very inconvenient if you don't need to localize only validation messages but even exception messages etc. If you have 2 exception boundaries its problem. One then has to pass references to services or have some context that aggregates them and all is done at one place.</p>
  
  <p>I already have ResourceBundleMessageSource extended because of other reasons, so it could have locale state, but I don't know what is the best approach to this problem.</p>
  
  <p>SHORTER VERSION :  when request is being passed to handler, grab User or Locale from Session and get CustomMessageSource from context and populate it > have the same CustomMessageSource instance available in Controller already Localized</p>
  
  <p>You don't have problems with MessageSource being automatically "localized" from session when request comes ?</p>
  
  <p>All references within the app context would point to localized messageResource.</p>
  
  <p>@Autowired
  private MessageSource resource;</p>
  
  <p>You can vote up <a href="https://jira.springsource.org/browse/SPR-8555" rel="nofollow">SPR-8555</a> for servlet environment and <a href="https://jira.springsource.org/browse/SPR-8558" rel="nofollow">SPR-8558</a> for Portlet environment.</p>