title: Spring internationalization: How to dynamically set locale value
body: <p>I am trying to implement internationalization through spring.Following are the configurations I have done</p>
  
  <pre><code>`&lt;bean id="messageSource"
        class="org.springframework.context.support.ResourceBundleMessageSource"&gt;
        &lt;property name="basenames" value="messages"&gt;
      &lt;/property&gt;
  &lt;/bean&gt; 
  
  &lt;bean id="localeResolver" class="org.springframework.web.servlet.i18n.SessionLocaleResolver" /&gt;`
  </code></pre>
  
  <p>now I have three properties file - message_en.properties,message_fr.properties,message_sp.properties.
  and use it in my jsp with JSTL  tag.
  My question is how can I pass locale value so that it can pick up right properties file?
  One way of doing is to pass in request url but my application is too huge to include this request parameter in every url.
  Is there any other way I can set locale value? I have locale value stored in DB from which I have to fetch and set.
  How can I achieve this with the best approach?</p>
  
  <p>Able to change the locale using below
           <code>RequestContextUtils.getLocaleResolver(request).setLocale(request, response,  Locale.FRANCE);</code></p>
  
  <p>But this will require to write a filter to execute on each request and firing a query in DB to get the value.
  Is there some better appraoach to do so?</p>