title: aspectj and spring with aspectj-autoproxy
body: <p>I've declared my aspects using the @Aspect annotation, but the advice does not seem to get applied. The aspect works in a few other projects that I have, and the key difference seems to be that the other projects are completely wired using annotations, and this particular project is xml wired. The only bean that is annotation wired is the Aspect. So I'm wondering if spring's aspectj support, when using aspectj-autoproxy  is sensitive to order that the beans are defined in the xml.</p>
  
  <p>For example, will beans declared after aspectj-autoproxy in xml be considered for AOP pointcuts?</p>
  
  <p>EDIT:</p>
  
  <p>I moved the <code>&lt;aop:aspectj-autoproxy /&gt;</code> until after all beans are created and still no luck.</p>
  
  <p>Basically my code consists of:</p>
  
  <pre><code>@Component
  @Aspect 
  public class SomeAspect {
      @Pointcut("@annotation(MyAnnotation)")
      public void isX() {}
  
      @After("isX()") 
      public void XX() {
          System.out.println("Called aspect");
      }
  }
  </code></pre>
  
  <p>And my controller has something like:</p>
  
  <pre><code>public class XController extends AbstractCommandController {
      @MyAnnotation
      public void handleX(...) {
          // do stuff
      }
      @Override
      protected void handle(...) {
          return handleX(...);
      }
  }
  </code></pre>
  
  <p>And then the spring xml is:</p>
  
  <pre><code>&lt;context:component-scan base-package="package.of.some.aspect" /&gt;
  &lt;aop:aspectj-autoproxy /&gt;
  
  &lt;!-- the rest of the beans below --&gt;
  &lt;bean id="someController" class="..." /&gt;
  </code></pre>
  
  <p>My previous projects captured and loaded all beans via the component-scan. That's what's different this time.</p>
  
  <p>EDIT2: 
  The other difference is that the other projects are using @Controller, and @RequestMethod. And in this case I'm using a derived class of AbstractCommmandController. I'm wondering if this applies:
  <a href="http://forum.springsource.org/archive/index.php/t-46637.html">http://forum.springsource.org/archive/index.php/t-46637.html</a></p>
  
  <p>Namely that I can't apply advice to any method except handleRequest().</p>
  
  <p>EDIT3:</p>
  
  <p>My latest try is to override handleRequest() and apply my annotation there. Under the assumption that when spring proxies my controller it will see the annotation and apply the advice, since it's calling through the public, externally called method. This still doesn't work.</p>