title: Autowiring Unmanaged Beans Annotated With @Component
body: <p>I want to use @AutoWired to inject a non-managed bean configured with @Component into a managed bean.  I'm pretty sure I have the configuration right, but for some reason I keep getting the exception:</p>
  
  <pre><code>No unique bean of type [foo.Baz] is defined: Unsatisfied dependency of type [class foo.Baz]: expected at least 1 matching bean
  </code></pre>
  
  <p>Based on the error, I'm guessing it's not able to find the Baz class, but I'm not sure why.  It's my understanding that the context:spring-configured element in the XML config was supposed to allow me to do this.  I also made sure to include the appropriate jar files (spring-weaving.jar and aspectjweaver.jar).</p>
  
  <p>Here's a simple example of my set up.</p>
  
  <p>My XML config:</p>
  
  <pre><code>&lt;beans ...&gt;
      ...
  
      &lt;context:annotation-config/&gt;
      &lt;context:spring-configured/&gt;
      &lt;context:component-scan base-package="foo"/&gt;
  
      &lt;bean id="bar" class="foo.Bar"/&gt;
      ...
  &lt;/beans&gt;
  </code></pre>
  
  <p>I have one managed bean:</p>
  
  <pre><code>package foo;
  
  public class Bar {
  
      @Autowired
      private Baz baz;
  
      public void setBaz(Baz baz) {
          this.baz = baz;
      }
  
      ...
  }
  </code></pre>
  
  <p>And one unmanaged bean:</p>
  
  <pre><code>package foo;
  
  @Component
  public class Baz {
      ...
  }
  </code></pre>
  
  <p>Is there something I'm missing?</p>
  
  <p><em>EDIT</em>: The log lists the beans its instantiating, and foo.Baz isn't one of them.  I don't know why it's not picking up the @Component annotated class.</p>