title: How to configure Spring MVC to load context through ContextSingletonBeanFactoryLocator
body: <p>There is a web application based on <code>Spring 3.2</code>. Here is how it's configured in web.xml:</p>
  
  <pre><code>&lt;servlet&gt;
      &lt;servlet-name&gt;MY-REST-API&lt;/servlet-name&gt;
      &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
      &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
  &lt;/servlet&gt;
  
  &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;MY-REST-API&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/foo/*&lt;/url-pattern&gt;
      &lt;url-pattern&gt;/bar/*&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  </code></pre>
  
  <p>Spring context is configured by XML file MY-REST-API-servlet.xml placed in a classpath. Nothing unusual as you can see.</p>
  
  <p>There is a code which is not in ApplicationContext. I'm looking for a way to give this code an ability to reach some beans in my Spring MVC app. AFAIK <code>ContextSingletonBeanFactoryLocator</code> can be used to solve such problems. But small investigation I've done with dubugger shows that Spring MVC doesn't use it by default while loading a context. None of <code>getInstance()</code> methods in <code>ContextSingletonBeanFactoryLocator</code> was called as Spring MVC bootstrapping. Hence a context received through <code>ContextSingletonBeanFactoryLocator</code> will be not the same as one loaded during bootstrap. I think the problem will be resolved if I make Spring MVC to use <code>ContextSingletonBeanFactoryLocator</code> in a context loading process.</p>
  
  <p>Is there a way to configure Spring MVC to use <code>ContextSingletonBeanFactoryLocator</code> during bootstrap?</p>