title: How to getBean() by Name programmatically
body: <p>I am using Spring3.1</p>
  
  <p>I have registered a Bean programmatically and I want to retrieve it programmatically as well but no success.</p>
  
  <pre><code>public void createBean(String beanName, String beanParam) {
      System.out.println("beanName=" + beanName + " beanParam=" + beanParam);
      ApplicationContext context = ApplicationContextSingleton.getApplicationContext();
      StaticApplicationContext innerContext;= new StaticApplicationContext(context);
      innerContext.registerSingleton("beanName", FixSessionBean.class);
      configureBean(innerContext, beanName, beanParam);
  } 
  
  public void configureBean(ApplicationContext innerContext, String beanName, String beanParam) {
      innerContext.getBean(beanName);
      FixSessionBean fixSessionBean = (FixSessionBean) innerContext.getBean(beanName);
  }
  </code></pre>
  
  <p>from my applicationContext:</p>
  
  <pre><code>&lt;bean id="FixSessionBean" class="com.finbird.fixgw.beans.FixSessionBean" /&gt;
  </code></pre>
  
  <p>Here is some log evidence:</p>
  
  <pre><code>beanName=mm1 beanParam=mm2
  2012-07-09 13:07:31,016 com.fixgw.test.TriggerBean [ERROR] org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'mm1' is defined
  org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'mm1' is defined
  </code></pre>
  
  <p>any idea why it's not going well?</p>
  
  <p>Thanks.</p>