title: Different behaviour when spring is used with junit
body: <p>I use spring 5 and I see, that spring behaves differently when I use it for tests (with junit 5) and in main code. The main thing, that singleton are not initialized during startup when I use spring for tests.</p>
  <p>For example, this is my code</p>
  <pre><code>@Component
  @Scope(value = ConfigurableBeanFactory.SCOPE_SINGLETON)
  public class Foo&lt;T&gt; {
  
      public Foo(Class&lt;T&gt; someClass) {
           //...
      }
  }
  </code></pre>
  <p>As it is seen, this class requires argument in constructor, so the instance of it I create manually - <code>context.getBean(....)</code>. When this class is used in tests - everything is ok. However, when I use it in main code I get at spring startup:</p>
  <pre><code>NoSuchBeanDefinitionException: No qualifying bean of type 'java.lang.Class&lt;?&gt;' available: expected at least 1 bean which qualifies as autowire candidate.
  </code></pre>
  <p>This is the example of my test:</p>
  <pre><code>@ExtendWith({SpringExtension.class})
  @ContextConfiguration(classes = ContextConfig.class)
  public class TestIT {}
  </code></pre>
  <p>How to explain such different behavior? I don't have much experience in spring, so would be thankful for any help.</p>