title: Spring Application Context Refresh in webapplication
body: <p>In my applicaition, during server startup a spring bean DAO class  reads values from database and stored in the hash map using spring jdbc template.</p>
  
  <p>I have a requirement to reload a specific set of bean(s) at run time without restarting  app servers. </p>
  
  <p>Below is my code snippet. I can post more if needed</p>
  
  <pre><code>private void setMessageDetails() {
  messageContentDetails= namedParameterJdbcTemplate.queryForObject(messageContentSql,nameParamMap, new MessageContentRowMapper());
  }
  
  MessageContentRowMapper.java maps the resultset values to valuesMap below
  
  public class MessageContentDetails {
  private Map&lt;String, Map&lt;String, String&gt;&gt; valuesMap= new HashMap&lt;String, Map&lt;String, String&gt;&gt;();
   ..setters/getters..
  } 
  </code></pre>
  
  <p>Now if any DB values changes, I need to reinitialize MessageContentDetails.java  and update hashmap with new values and also autowire again  reference of this class where ever it is previously autowired/injected during application startup.</p>
  
  <p>My question is </p>
  
  <ol>
  <li>Can i refresh one or a set of few spring beans using applicationContext.refresh() method. </li>
  <li>Is there any better way to reload spring beans that has some static values which needs to be reloaded at run time?</li>
  <li>What are the possible thread impacts of using this method. My application is distributed over 3 different data centers with multiple jvms. </li>
  </ol>
  
  <p>Any link towards my above questions will be very helpful. </p>
  
  <p>I am using JAVA 1.6 WebSphere Spring 3.1.0 version and the MessageContentDetails  bean is a spring bean configured in spring xml with not annotations. </p>