title: Spring AOP Advice on Annotated Controllers
body: <p>I am trying to use AOP to do some processing after an annotated controller. Everything is running with no errors, but the advice is not being executed. </p>
  
  <p>Here is the controller code:</p>
  
  <pre><code>@Controller
  public class HomeController {       
      @RequestMapping("/home.fo")
      public String home(ModelMap model) {
          model = new ModelMap();
          return "home";
      }   
  }
  </code></pre>
  
  <p>and the setup in application-config</p>
  
  <pre><code>&lt;aop:aspectj-autoproxy/&gt;
  
  &lt;bean id="testAdvice" class="com.test.TestAdvice"&gt;
  &lt;/bean&gt;
  
  &lt;bean id="testAdvisor"
      class="org.springframework.aop.aspectj.AspectJExpressionPointcutAdvisor"&gt;
      &lt;property name="advice" ref="testAdvice" /&gt;
      &lt;property name="expression" value="execution(* *.home(..))" /&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>and the actual advice</p>
  
  <pre><code>public class TestAdvice implements AfterReturningAdvice {
  
      protected final Log logger = LogFactory.getLog(getClass());
  
      public void afterReturning(Object returnValue, Method method, Object[] args,
              Object target) throws Throwable {
          logger.info("Called after returning advice!");
      }
  }
  </code></pre>
  
  <p>Is it even possible to have advice on annotated controllers? I am using Spring 2.5.</p>