title: Spring Struts 1 advice is not being invoked
body: <p>Our project architecture uses Struts 1 and Struts 2 with Spring 3. I am trying to create an Aspect for better exception handling. Struts 1 was until now not Spring managed - So I followed this link <a href="https://stackoverflow.com/questions/5835910/how-to-integrate-an-old-struts-application-with-spring-3-x">How to integrate an old Struts application with Spring 3.x</a> to allow Spring component-scan to pick up the Struts 1 Action.</p>
  
  <p>Edit: - Versions</p>
  
  <p>Struts 1 - org.apache.struts.struts-core (1.3.10)
  Struts 2 - org.apache.struts.struts2-core (2.0.9)
  Spring - 3.2.2</p>
  
  <p>But my aspect class does not pick it up. I don't face any problems with my struts 2 actions or service classes. But I am unable to understand what is wrong here.</p>
  
  <p>The Exception Aspect class - </p>
  
  <pre><code>package com.mnm.abc.aop;
  public @Aspect @Component class ExceptionHandler {
      @Pointcut("execution(public * abc.web.action.AbcAction+.doExecute(..))")
      public void inStruts1Action() {
      }
  
  /* I tried the following too
  * @Pointcut("within(abc.web.action.AbcAction+)")
  * @Pointcut("execution(public * abc.web.action.AbcAction.execute(..))")
  * @Pointcut("execution(public * abc.web.action.*.doExecute(..)) &amp;&amp; within(abc.web.action.AbcAction+)")
  */
      @After("inStruts1Action()")
      public void after() {
          System.out.println("After");
      }
  }
  </code></pre>
  
  <p>The Struts 1 Action class - </p>
  
  <pre><code>package abc.web.action;
  public @Component class TransactionAction extends AbcAction {
      public @Override ActionForward doExecute(ActionMapping mapping, ActionForm form,
              HttpServletRequest request, HttpServletResponse response)
              throws Exception {
          System.out.println("Hi");
          ActionForward forward = mapping.findForward("success");
          return forward;
      }
  }
  </code></pre>
  
  <p>The Parent class - </p>
  
  <pre><code>package abc.web.action;
  public abstract class AbcAction extends Action {
      public ActionForward execute(ActionMapping mapping, ActionForm form,
              HttpServletRequest request, HttpServletResponse response)
              throws Exception {
          try {
              return doExecute(mapping, form, request, response);
          } catch (Exception e) {
              e.printStackTrace();
              throw e;
          }
      }
      public abstract ActionForward doExecute(ActionMapping mapping,
              ActionForm form, HttpServletRequest request,
              HttpServletResponse response) throws Exception;
  }
  </code></pre>
  
  <p>The Configuration class - </p>
  
  <pre><code>package com.mnm.abc.config;
  @Configuration
  @ComponentScan(basePackages = { "abc.web.action", "com.mnm.abc.aop" })
  @EnableTransactionManagement
  @EnableScheduling
  @EnableAspectJAutoProxy(proxyTargetClass=true)
  public class DataSourceConfig implements TransactionManagementConfigurer { ... }
  </code></pre>
  
  <p>When I went through the debug logs I get the following messages</p>
  
  <pre><code>Identified candidate component class: file [C:\...\abc\web\action\TransactionAction.class]
  ...
  org.springframework.beans.factory.support.DefaultListableBeanFactory  - Creating shared instance of singleton bean 'transactionAction'
  org.springframework.beans.factory.support.DefaultListableBeanFactory  - Creating instance of bean 'transactionAction'
  org.springframework.beans.factory.support.DefaultListableBeanFactory  - Returning cached instance of singleton bean 'org.springframework.transaction.config.internalTransactionAdvisor'
  org.springframework.beans.factory.support.DefaultListableBeanFactory  - Eagerly caching bean 'transactionAction' to allow for resolving potential circular references
  org.springframework.beans.factory.support.DefaultListableBeanFactory  - Returning cached instance of singleton bean 'org.springframework.transaction.config.internalTransactionAdvisor'
  org.springframework.beans.factory.support.DefaultListableBeanFactory  - Returning cached instance of singleton bean 'org.springframework.transaction.config.internalTransactionAdvisor'
  org.springframework.aop.aspectj.annotation.AnnotationAwareAspectJAutoProxyCreator  - Creating implicit proxy for bean 'transactionAction' with 0 common interceptors and 2 specific interceptors
  org.springframework.aop.framework.Cglib2AopProxy  - Creating CGLIB2 proxy: target source is SingletonTargetSource for target object [abc.web.action.TransactionAction@1d3981c]
  org.springframework.aop.framework.Cglib2AopProxy  - Unable to apply any optimisations to advised method: public org.apache.struts.action.ActionForward abc.web.action.TransactionAction.doExecute(org.apache.struts.action.ActionMapping,org.apache.struts.action.ActionForm,javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse) throws java.lang.Exception
  org.springframework.aop.framework.Cglib2AopProxy  - Unable to apply any optimisations to advised method: public org.apache.struts.action.ActionForward abc.web.action.AbcAction.execute(org.apache.struts.action.ActionMapping,org.apache.struts.action.ActionForm,javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse) throws java.lang.Exception
  org.springframework.aop.framework.Cglib2AopProxy  - Unable to apply any optimisations to advised method: protected org.apache.struts.util.MessageResources org.apache.struts.action.Action.getResources(javax.servlet.http.HttpServletRequest)
  org.springframework.aop.framework.Cglib2AopProxy  - Unable to apply any optimisations to advised method: protected org.apache.struts.util.MessageResources org.apache.struts.action.Action.getResources(javax.servlet.http.HttpServletRequest,java.lang.String)
  org.springframework.aop.framework.Cglib2AopProxy  - Unable to apply any optimisations to advised method: public org.apache.struts.action.ActionForward org.apache.struts.action.Action.execute(org.apache.struts.action.ActionMapping,org.apache.struts.action.ActionForm,javax.servlet.ServletRequest,javax.servlet.ServletResponse) throws java.lang.Exception
  org.springframework.aop.framework.Cglib2AopProxy  - Unable to apply any optimisations to advised method: protected java.util.Locale org.apache.struts.action.Action.getLocale(javax.servlet.http.HttpServletRequest)
  org.springframework.aop.framework.Cglib2AopProxy  - Unable to apply any optimisations to advised method: protected void org.apache.struts.action.Action.setLocale(javax.servlet.http.HttpServletRequest,java.util.Locale)
  org.springframework.aop.framework.Cglib2AopProxy  - Unable to apply any optimisations to advised method: public org.apache.struts.action.ActionServlet org.apache.struts.action.Action.getServlet()
  org.springframework.aop.framework.Cglib2AopProxy  - Unable to apply any optimisations to advised method: public void org.apache.struts.action.Action.setServlet(org.apache.struts.action.ActionServlet)
  org.springframework.aop.framework.Cglib2AopProxy  - Unable to apply any optimisations to advised method: protected boolean org.apache.struts.action.Action.isCancelled(javax.servlet.http.HttpServletRequest)
  org.springframework.aop.framework.Cglib2AopProxy  - Unable to apply any optimisations to advised method: protected org.apache.struts.action.ActionMessages org.apache.struts.action.Action.getErrors(javax.servlet.http.HttpServletRequest)
  org.springframework.aop.framework.Cglib2AopProxy  - Unable to apply any optimisations to advised method: protected void org.apache.struts.action.Action.addMessages(javax.servlet.http.HttpServletRequest,org.apache.struts.action.ActionMessages)
  org.springframework.aop.framework.Cglib2AopProxy  - Unable to apply any optimisations to advised method: protected void org.apache.struts.action.Action.addErrors(javax.servlet.http.HttpServletRequest,org.apache.struts.action.ActionMessages)
  org.springframework.aop.framework.Cglib2AopProxy  - Unable to apply any optimisations to advised method: protected boolean org.apache.struts.action.Action.isTokenValid(javax.servlet.http.HttpServletRequest,boolean)
  org.springframework.aop.framework.Cglib2AopProxy  - Unable to apply any optimisations to advised method: protected boolean org.apache.struts.action.Action.isTokenValid(javax.servlet.http.HttpServletRequest)
  org.springframework.aop.framework.Cglib2AopProxy  - Unable to apply any optimisations to advised method: protected void org.apache.struts.action.Action.resetToken(javax.servlet.http.HttpServletRequest)
  org.springframework.aop.framework.Cglib2AopProxy  - Unable to apply any optimisations to advised method: protected void org.apache.struts.action.Action.saveErrors(javax.servlet.http.HttpServletRequest,org.apache.struts.action.ActionMessages)
  org.springframework.aop.framework.Cglib2AopProxy  - Unable to apply any optimisations to advised method: protected void org.apache.struts.action.Action.saveErrors(javax.servlet.http.HttpServletRequest,org.apache.struts.action.ActionErrors)
  org.springframework.aop.framework.Cglib2AopProxy  - Unable to apply any optimisations to advised method: protected void org.apache.struts.action.Action.saveMessages(javax.servlet.http.HttpServletRequest,org.apache.struts.action.ActionMessages)
  org.springframework.aop.framework.Cglib2AopProxy  - Unable to apply any optimisations to advised method: protected void org.apache.struts.action.Action.saveMessages(javax.servlet.http.HttpSession,org.apache.struts.action.ActionMessages)
  org.springframework.aop.framework.Cglib2AopProxy  - Unable to apply any optimisations to advised method: protected void org.apache.struts.action.Action.saveToken(javax.servlet.http.HttpServletRequest)
  org.springframework.aop.framework.Cglib2AopProxy  - Unable to apply any optimisations to advised method: protected java.lang.String org.apache.struts.action.Action.generateToken(javax.servlet.http.HttpServletRequest)
  org.springframework.aop.framework.Cglib2AopProxy  - Unable to apply any optimisations to advised method: protected org.apache.struts.action.ActionMessages org.apache.struts.action.Action.getMessages(javax.servlet.http.HttpServletRequest)
  org.springframework.aop.framework.Cglib2AopProxy  - Unable to apply any optimisations to advised method: protected javax.sql.DataSource org.apache.struts.action.Action.getDataSource(javax.servlet.http.HttpServletRequest)
  org.springframework.aop.framework.Cglib2AopProxy  - Unable to apply any optimisations to advised method: protected javax.sql.DataSource org.apache.struts.action.Action.getDataSource(javax.servlet.http.HttpServletRequest,java.lang.String)
  org.springframework.aop.framework.Cglib2AopProxy  - Found finalize() method - using NO_OVERRIDE
  org.springframework.aop.framework.Cglib2AopProxy  - Found 'equals' method: public boolean java.lang.Object.equals(java.lang.Object)
  org.springframework.aop.framework.Cglib2AopProxy  - Unable to apply any optimisations to advised method: public java.lang.String java.lang.Object.toString()
  org.springframework.aop.framework.Cglib2AopProxy  - Found 'hashCode' method: public native int java.lang.Object.hashCode()
  org.springframework.aop.framework.Cglib2AopProxy  - Unable to apply any optimisations to advised method: protected native java.lang.Object java.lang.Object.clone() throws java.lang.CloneNotSupportedException
  org.springframework.aop.framework.Cglib2AopProxy  - Method is declared on Advised interface: public abstract int org.springframework.aop.framework.Advised.indexOf(org.springframework.aop.Advisor)
  org.springframework.aop.framework.Cglib2AopProxy  - Method is declared on Advised interface: public abstract int org.springframework.aop.framework.Advised.indexOf(org.aopalliance.aop.Advice)
  org.springframework.aop.framework.Cglib2AopProxy  - Method is declared on Advised interface: public abstract boolean org.springframework.aop.framework.Advised.isFrozen()
  org.springframework.aop.framework.Cglib2AopProxy  - Method is declared on Advised interface: public abstract org.springframework.aop.Advisor[] org.springframework.aop.framework.Advised.getAdvisors()
  org.springframework.aop.framework.Cglib2AopProxy  - Method is declared on Advised interface: public abstract boolean org.springframework.aop.framework.Advised.removeAdvice(org.aopalliance.aop.Advice)
  org.springframework.aop.framework.Cglib2AopProxy  - Method is declared on Advised interface: public abstract void org.springframework.aop.framework.Advised.addAdvice(org.aopalliance.aop.Advice) throws org.springframework.aop.framework.AopConfigException
  org.springframework.aop.framework.Cglib2AopProxy  - Method is declared on Advised interface: public abstract void org.springframework.aop.framework.Advised.addAdvice(int,org.aopalliance.aop.Advice) throws org.springframework.aop.framework.AopConfigException
  org.springframework.aop.framework.Cglib2AopProxy  - Method is declared on Advised interface: public abstract boolean org.springframework.aop.framework.Advised.isPreFiltered()
  org.springframework.aop.framework.Cglib2AopProxy  - Method is declared on Advised interface: public abstract java.lang.Class[] org.springframework.aop.framework.Advised.getProxiedInterfaces()
  org.springframework.aop.framework.Cglib2AopProxy  - Method is declared on Advised interface: public abstract boolean org.springframework.aop.framework.Advised.isInterfaceProxied(java.lang.Class)
  org.springframework.aop.framework.Cglib2AopProxy  - Method is declared on Advised interface: public abstract void org.springframework.aop.framework.Advised.removeAdvisor(int) throws org.springframework.aop.framework.AopConfigException
  org.springframework.aop.framework.Cglib2AopProxy  - Method is declared on Advised interface: public abstract boolean org.springframework.aop.framework.Advised.removeAdvisor(org.springframework.aop.Advisor)
  org.springframework.aop.framework.Cglib2AopProxy  - Method is declared on Advised interface: public abstract boolean org.springframework.aop.framework.Advised.replaceAdvisor(org.springframework.aop.Advisor,org.springframework.aop.Advisor) throws org.springframework.aop.framework.AopConfigException
  org.springframework.aop.framework.Cglib2AopProxy  - Method is declared on Advised interface: public abstract java.lang.String org.springframework.aop.framework.Advised.toProxyConfigString()
  org.springframework.aop.framework.Cglib2AopProxy  - Method is declared on Advised interface: public abstract org.springframework.aop.TargetSource org.springframework.aop.framework.Advised.getTargetSource()
  org.springframework.aop.framework.Cglib2AopProxy  - Method is declared on Advised interface: public abstract void org.springframework.aop.framework.Advised.setTargetSource(org.springframework.aop.TargetSource)
  org.springframework.aop.framework.Cglib2AopProxy  - Method is declared on Advised interface: public abstract void org.springframework.aop.framework.Advised.setPreFiltered(boolean)
  org.springframework.aop.framework.Cglib2AopProxy  - Method is declared on Advised interface: public abstract boolean org.springframework.aop.framework.Advised.isProxyTargetClass()
  org.springframework.aop.framework.Cglib2AopProxy  - Method is declared on Advised interface: public abstract void org.springframework.aop.framework.Advised.setExposeProxy(boolean)
  org.springframework.aop.framework.Cglib2AopProxy  - Method is declared on Advised interface: public abstract boolean org.springframework.aop.framework.Advised.isExposeProxy()
  org.springframework.aop.framework.Cglib2AopProxy  - Method is declared on Advised interface: public abstract void org.springframework.aop.framework.Advised.addAdvisor(org.springframework.aop.Advisor) throws org.springframework.aop.framework.AopConfigException
  org.springframework.aop.framework.Cglib2AopProxy  - Method is declared on Advised interface: public abstract void org.springframework.aop.framework.Advised.addAdvisor(int,org.springframework.aop.Advisor) throws org.springframework.aop.framework.AopConfigException
  org.springframework.aop.framework.Cglib2AopProxy  - Method is declared on Advised interface: public abstract java.lang.Class org.springframework.aop.TargetClassAware.getTargetClass()
  org.springframework.beans.factory.support.DefaultListableBeanFactory  - Finished creating instance of bean 'transactionAction'
  </code></pre>
  
  <p>I also read quite a bit of info about abstract method calls and AOP but nothing seems to work. Please help me out.</p>