Spring AOP proxy and interface implementation
<p>I'm trying to understand Spring proxy mechanism and I have problem with one thing.
I have Interface:</p>

<pre><code>public interface MyInterface{
  void myMethod();
}
</code></pre>

<p>and implementing class:</p>

<pre><code>@Component
public class MyBean implements MyInterface{
  @Override
  public void myMethod(){
    //do something
  }
}
</code></pre>

<p>Now I create Aspect, for example:</p>

<pre><code>@Aspect
@Component
public class LogAspect {
    @Before("execution(public * *(..))")
    public void logBefore() {
        System.out.println("Before aspect");
    }
}
</code></pre>

<p>And I have simple starter class:</p>

<pre><code>@Configuration
@ComponentScan
@EnableAspectJAutoProxy
public class SpringAopApplication {
    public static void main(String[] args) {
        AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(
                SpringAopApplication.class);

        MyBean bean = ctx.getBean(MyBean.class);
//      MyInterface bean = ctx.getBean(MyInterface.class); //works
        bean.myMethod();

        ctx.close();
    }
}
</code></pre>

<p>According to the Spring docs we can read:</p>

<blockquote>
  <p>If the target object to be proxied implements at least one interface
  then a JDK dynamic proxy will be used. All of the interfaces
  implemented by the target type will be proxied. If the target object
  does not implement any interfaces then a CGLIB proxy will be created.</p>
</blockquote>

<p>But I got an error <em>No qualifying bean of type [MyBean] is defined</em>. It works only when I enable CGLib proxying by <code>@EnableAspectJAutoProxy(proxyTargetClass = true)</code>.
Can someone explain what I am missing here? Why MyBean is not discovered when using AOP? <code>ctx.getBean(MyInterface.class)</code> works, but I can't imagine the situation with many implementations of such interface.</p>