title: In spring, is there a way to autowire the first bean?
body: <p>In the example below, is there a way to avoid doing a context.getBean()? All the other beans subsequently used by the testService get autowired. (It is a console application)</p>
  
  <pre><code>public class Test { 
  
  
          private static ITestService testService;
  
          private static ApplicationContext context;
  
             public static void main(String[] args) { 
  
              context = new ClassPathXmlApplicationContext(
                      new String[]{"/META-INF/spring/app-context.xml"});
              ITestService testService = context.getBean(ITestService.class); 
  
          }
  
  }
  </code></pre>
  
  <p>I tried adding autowire annotation to ApplicationContext, but it didnt work. Besides how does it know where my app-context.xml is located if I autowire it?</p>
  
  <p><strong>Update</strong>: I found what I needed <a href="https://stackoverflow.com/questions/3659720/using-spring-3-autowire-in-a-standalone-java-application">over here</a></p>