title: Singleton bean in two contexts spring
body: <p>I have a web application context(for DISPATCHER) and also Web Services context(for MESSAGE DISPATCHER) in a web application. 
  I have one bean which is singleton and i need that bean in both contexts. 
  if i specify the bean as singleton in both contexts then it is not singleton any more. 
  please suggest a solution or guide me in right direction.</p>
  
  <pre><code>&lt;servlet&gt;
      &lt;servlet-name&gt;ws&lt;/servlet-name&gt;
      &lt;servlet-class&gt;org.springframework.ws.transport.http.MessageDispatcherServlet&lt;/servlet-class&gt;        
      &lt;init-param&gt;
          &lt;param-name&gt;transformWsdlLocations&lt;/param-name&gt;
          &lt;param-value&gt;true&lt;/param-value&gt;
      &lt;/init-param&gt;       
  &lt;/servlet&gt;
  
  &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;ws&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/service/*&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  
  &lt;servlet&gt;
      &lt;servlet-name&gt;mvc&lt;/servlet-name&gt;
      &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;        
  &lt;/servlet&gt;
  
  &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;mvc&lt;/servlet-name&gt;
      &lt;url-pattern&gt;*.htm&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  
  &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;mvc&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  </code></pre>