title: Spring 3 class to hold and return a single bean instance?
body: <p>Let's say I have a spring bean I want to use through out my application, but because it's legacy code I can't make every single class I want to use it in a <code>@Component</code> or any kind of bean because the class is being manually instantiated through out the project, so I can't just @Autowire it where I want it.</p>
  
  <p>How can I create a wrapper class for a spring bean I want to reuse configured as below, so that it will do nothing other than return the instance of the bean registered on the application context?</p>
  
  <pre><code>@Service("myBean")
  public class MyBean {
  </code></pre>
  
  <p>Basically I'm looking for something like <code>MyBeanHolder.java</code> with a method like:</p>
  
  <pre><code>public MyBean getGlobalInstance() {
       //return my global instance of MyBean
  }
  </code></pre>
  
  <p>So this way, anywhere I want to use MyBean, I can fetch the instance via this <code>getGlobalInstance()</code> method.</p>
  
  <p>How can I achieve this running Spring 3.X?</p>