title: Get a bean (programmatically registered) from Spring context?
body: <p>I registered a bean programmatically:</p>
  
  <pre><code>@Autowired
  private GenericApplicationContext applicationContext;
  
  [...]
  
  applicationContext.registerBean("a0", A.class, () -&gt; new A(0));
  
  // make sure to set up the bean
  applicationContext.getBean("a0");
  </code></pre>
  
  <p>When I want to get this bean by name, it works and always returns the same instance:</p>
  
  <pre><code>applicationContext.getBean("a0");
  </code></pre>
  
  <p>But when I want to get all beans of type A.class, it returns en empty Map:</p>
  
  <pre><code>Map&lt;String, A&gt; as = applicationContext.getBeansOfType(A.class);
  </code></pre>
  
  <p>as = [] !!!</p>
  
  <p>I'm working with Spring 5.0,
  Why does Spring consider have no bean of type A in my context while I can retrieve them by name ?</p>