title: @ContextConfiguration with SpringExtension does not detect explicitly defined @Bean
body: <p>I am using JUnit5 with <code>SpringExtension</code>. But for reason the first test succeeds while the second one fail</p>
  
  <p>Can anyone tell me why this fails?</p>
  
  <pre class="lang-java prettyprint-override"><code>package com.acme;
  
  import org.junit.jupiter.api.Test;
  import org.junit.jupiter.api.extension.ExtendWith;
  import org.springframework.context.annotation.AnnotationConfigApplicationContext;
  import org.springframework.context.annotation.Bean;
  import org.springframework.context.annotation.Configuration;
  import org.springframework.test.context.ContextConfiguration;
  import org.springframework.test.context.junit.jupiter.SpringExtension;
  
  import static org.assertj.core.api.Assertions.assertThat;
  
  @ExtendWith(SpringExtension.class)
  @ContextConfiguration(classes = ConfigurationTest.Config.class)
  public class ConfigurationTest {
    @Test
    void explicitContextTest() {
      AnnotationConfigApplicationContext applicationContext =
          new AnnotationConfigApplicationContext(Config.class);
      assertThat(applicationContext.getBean(Skeleton.class)).isNotNull();
    }
  
    @Test
    void contextConfigInjectionTest(Skeleton skeleton) {
      assertThat(skeleton).isNotNull();
    }
  
    @Configuration
    static class Config {
      @Bean
      Skeleton skeleton() {
        return new SkeletonImpl();
      }
    }
  
    interface Skeleton {
    }
  
    static class SkeletonImpl implements Skeleton {
    }
  }
  </code></pre>
  
  <p>PS: If I add <code>@ComponentScan</code> at <code>Config</code> class level, the second test also succeed. The question is more along the lines of why spring test is not able to detect explicitly defined beans unless I ask it to scan explicitly</p>