<p>My project is based on spring framework 2.5.4. And I try to add aspects for some controllers (I use aspectj 1.5.3).</p>

<p>I've enabled auto-proxy in application-servlet.xml, just pasted these lines to the end of the xml file:</p>

<pre><code>&lt;aop:aspectj-autoproxy /&gt;
&lt;bean id="auditLogProcessor" class="com.example.bg.web.utils.AuditLogProcessor" /&gt;
</code></pre>

<p>Created aspect:</p>

<pre><code>package com.example.bg.web.utils;

import org.apache.log4j.Logger;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;

@Aspect
public class AuditLogProcessor
{
    private final static Logger log = Logger.getLogger(AuditLogProcessor.class);

    @After("execution(* com.example.bg.web.controllers.assets.AssetThumbnailRebuildController.rebuildThumbnail(..))")
    public void afterHandleRequest() {
        log.info("test111");
    }

    @After("execution(* com.example.bg.web.controllers.assets.AssetThumbnailRebuildController.rebuildThumbnail(..))")
    public void afterRebuildThumbnail() {
        log.info("test222");
    }
}</code></pre>

<p>My controllers:</p>

<pre><code>class AssetAddController implements Controller
class AssetThumbnailRebuildController extends MultiActionController</code></pre>

<p>When I set brake points in aspect advisors and invoke controllers I catch only afterHandleRequest() but not afterRebildThumbnail()
What did I do wrong?</p>

<p><strong>NOTE</strong></p>

<p>I'm asking this question on behalf of my friend who doesn't have access to SO beta, and I don't have a clue what it's all about.</p>

<p><strong>EDIT</strong></p>

<p>There were indeed some misspellings, thanks Cheekysoft. But the problem still persists.</p>

[{'answer_id': 39766, 'author': 'bpapa', 'author_id': 543, 'author_profile': 'https://Stackoverflow.com/users/543', 'pm_score': 1, 'selected': False, 'text': '<p>AspectJ doesn\'t work well with classes in the Spring Web MVC framework. <a href="http://static.springframework.org/spring/docs/2.0.x/reference/mvc.html" rel="nofollow noreferrer">Read the bottom of the "Open for extension..." box on the right side of the page</a> </p>\n\n<p>Instead, take a look at the <a href="http://static.springframework.org/spring/docs/2.0.x/api/org/springframework/web/servlet/HandlerInterceptor.html" rel="nofollow noreferrer">HandlerInterceptor</a> interface. </p>\n\n<p>The new Spring MVC Annotations may work as well since then the Controller classes are all POJOs, but I haven\'t tried it myself. </p>\n'}, {'answer_id': 41457, 'author': 'Cheekysoft', 'author_id': 1820, 'author_profile': 'https://Stackoverflow.com/users/1820', 'pm_score': 0, 'selected': False, 'text': "<p>Is this as simple as spelling? or are there just typos in the question?\nSometimes you write <code>rebuildThumbnail</code> and sometimes you write <code>rebildThumbnail</code></p>\n\n<p>The methods you are trying to override with advice are not final methods in the MVC framework, so whilst bpapas answer is useful, my understanding is that this is not the problem in this case. However, do make sure that the <code>rebuildThumbnail</code> controller action is not final</p>\n\n<p>@bpapas: please correct me if I'm wrong. The programmer's own controller action is what he is trying to override. Looking at the MultiActionController source (and its parents') the only finalized method potentially in the stack is <code>MultiActionController.invokeNamedMethod</code>, although I'm not 100% sure if this would be in the stack at that time or not. Would having a finalized method higher up the stack cause a problem adding AOP advice to a method further down?</p>\n"}, {'answer_id': 41480, 'author': 'Cheekysoft', 'author_id': 1820, 'author_profile': 'https://Stackoverflow.com/users/1820', 'pm_score': 1, 'selected': False, 'text': '<p>The basic setup looks ok.</p>\n\n<p>The syntax can be simplified slightly by not defining an in-place pointcut and just specifying the method to which the after-advice should be applied. (The named pointcuts for methods are automatically created for you.)</p>\n\n<p>e.g.</p>\n\n<pre><code>@After( "com.example.bg.web.controllers.assets.AssetAddController.handleRequest()" )\npublic void afterHandleRequest() {\n    log.info( "test111" );\n}\n\n@After( "com.example.bg.web.controllers.assets.AssetThumbnailRebuildController.rebuildThumbnail()" )   \npublic void afterRebuildThumbnail() {\n    log.info( "test222" );\n}\n</code></pre>\n\n<p>As long as the rebuildThumbnail method is not final, and the method name and class are correct. I don\'t see why this won\'t work.</p>\n\n<p>see <a href="http://static.springframework.org/spring/docs/2.0.x/reference/aop.html" rel="nofollow noreferrer">http://static.springframework.org/spring/docs/2.0.x/reference/aop.html</a></p>\n'}, {'answer_id': 67661, 'author': 'Ed Thomas', 'author_id': 8256, 'author_profile': 'https://Stackoverflow.com/users/8256', 'pm_score': 3, 'selected': True, 'text': '<p>Your breakpoints aren\'t being hit because you are using Spring\'s AOP Proxies. See <a href="http://static.springframework.org/spring/docs/2.5.x/reference/aop.html#aop-understanding-aop-proxies" rel="nofollow noreferrer">understanding-aop-proxies</a> for a description of how AOP Proxies are special. </p>\n\n<p>Basically, the MVC framework is going to call the <code>handleRequest</code> method on your controller\'s proxy (which for example the <code>MultiActionController</code> you\'re using as a base class implements), this method will then make an "internal" call to its rebuildThumbnail method, but this won\'t go through the proxy and thus won\'t pick up any aspects. (This has nothing to do with the methods being final.)</p>\n\n<p>To achieve what you want, investigate using "real" AOP via load time weaving (which Spring supports very nicely).</p>\n'}]
['https://Stackoverflow.com/questions/39639', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1007/']