title: How can an application inform the Spring application context where to find a class whose constructor is annotated with @Inject?
body: <p>How can I fix the following example in order to inform the <a href="http://projects.spring.io/spring-framework/" rel="nofollow">Spring</a> <a href="http://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/context/ApplicationContext.html" rel="nofollow">application context</a> where to find a class <code>Application</code> whose constructor is annotated with <a href="http://docs.oracle.com/javaee/6/api/index.html?javax/inject/Inject.html" rel="nofollow"><code>@Inject</code></a>, but <em>without</em> introducing a bean method to <code>ApplicationConfiguration</code> annotated with <code>@Bean</code> that returns an instance of class <code>Application</code>?</p>
  
  <pre><code>public class Application {
      private final A a;
  
      @Inject
      public Application(A a) {
          this.a = a;
      }
  
      public A getA() {
          return a;
      }
  }
  
  @Configuration
  public class ApplicationConfiguration {
      @Bean
      public A getA() {
          return new A();
      }
  }
  
  public class A {
  }
  
  public class Start {
      public static void main(String[] arguments) {
          final ApplicationContext context = new AnnotationConfigApplicationContext(ApplicationConfiguration.class);
          final Application application = context.getBean(Application.class);
          application.getA();
      }
  }
  </code></pre>
  
  <p>You can review the source code in the <a href="https://github.com/derekmahar/AtInject/tree/353ed6c66d4d5f2aef923acceb1944a872a9418f" rel="nofollow">AtInject</a> project on <a href="https://github.com/" rel="nofollow">GitHub</a>.</p>
  
  <p>When I run class <code>Start</code>, Spring complains that it cannot find class <code>Application</code>:</p>
  
  <pre><code>May 27, 2016 4:49:55 PM org.springframework.context.annotation.AnnotationConfigApplicationContext prepareRefresh
  INFO: Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@7eda2dbb: startup date [Fri May 27 16:49:55 EDT 2016]; root of context hierarchy
  May 27, 2016 4:49:55 PM org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor &lt;init&gt;
  INFO: JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
  Exception in thread "main" org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.opessoftware.atinject.application.Application] is defined
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:371)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:331)
      at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:975)
      at com.opessoftware.atinject.start.Start.main(Start.java:11)
  </code></pre>