title: How do I pass arguments to Spring AOP advice with annotated parameters?
body: <p>I am using Spring 3.1.2.RELEASE with cglib load-time weaving and I am trying to get advice to work with a method that has custom annotations and annotated parameters.</p>
  
  <p>Advice:</p>
  
  <pre><code>@Aspect
  public class MyAdvice
  {
     @Around("execution(@com.mycompany.locking.Lock * *(@com.mycompany.locking.LockVal(*), ..)) " +
     "&amp;&amp; args(batch) &amp;&amp; @args(propertyToLock)"
     public Object lockAndProceed(ProceedingJoinPoint pjp, Object batch, LockVal propertyToLock) throws Throwable { 
          //Do stuff.... 
          pjp.proceed();
     }
  }
  </code></pre>
  
  <p>Here is the class that I am testing:</p>
  
  <pre><code>public interface UpdateManager
  {
     public void processUpdate(MyBatchObject batch);
  }
  
  
  public class UpdateManagerImpl implements UpdateManager
  {
     @Lock
     public void processUpdate(@LockVal("lockValue") MyBatchObject batch)
     {
        //Do stuff...
     }
  }
  </code></pre>
  
  <p>The problem is that I can't get the advice to execute.  If I remove the @args and args conditions in the pointcut, the advice fires, but then I have to dig through the ProceedingJoinPoint to get the parameter that I need.</p>
  
  <p>Why isn't the advice firing?  Did I do something wrong?</p>
  
  <p><strong>Edit</strong>: The following pointcut DOES WORK as a standalone program with Spring:</p>
  
  <pre><code>@Aspect
  public class MyAdvice
  {
     @Around("execution(@com.mycompany.locking.Lock * *(@com.mycompany.locking.LockVal(*), ..)) " +
     "&amp;&amp; args(batch)"
     public Object lockAndProceed(ProceedingJoinPoint pjp, Object batch) throws Throwable { 
          //Do stuff.... 
          pjp.proceed();
     }
  }
  </code></pre>
  
  <p>However, it does NOT work under JBoss 6 using load-time weaving.  I suppose my question should be, then, why does it work as a standalone program but not under JBoss 6?</p>