title: How to print ApplicationContext subclass bean by using context
body: <p>I used below code sample and while debugging i found out that in context variable <code>GenericWebApplicationContext</code> is getting injected:</p>
  <pre><code>@SpringBootTest
  class DemoApplicationTests {
  
      @Autowired
      ApplicationContext context;
  
      @Test
      void contextLoads() {
          System.out.println(&quot;following beans are present in container***&quot;);
          List&lt;String&gt; beansInContainer = Arrays.asList(context.getBeanDefinitionNames());
          for (String bean : beansInContainer){
              System.out.println(&quot;bean is &quot;+bean);
          }
      }
  }
  </code></pre>
  <p>I have 2 doubts :</p>
  <ol>
  <li><code>GenericWebApplicationContext</code> is getting  injected so i assume it is in context, then how to print it using context. Tried printing with above way but it didn't show this bean. Also tried with /actuator/bean endpoint but it too didn't show this bean</li>
  <li>How is <code>GenericWebApplicationContext</code> bean is getting injected when no <code>@Component</code>, <code>@Service</code>, <code>@Bean</code> is defined on it.I could see in spring framework object getting created with new keyword for this class but want to confirm this.</li>
  </ol>