This forum is now a read-only archive. All commenting, posting, registration services have been turned off. Those needing community support and/or wanting to ask questions should refer to the Tag/Forum map, and to http://spring.io/questions for a curated list of stackoverflow tags that Pivotal engineers, and the community, monitor.

The MyAspect bean is created for sure (loaded with application context and used in different beans). Also I know that the @Pointcut itself is detected because the PointcutParser parses the expression successfully (it also means that the expression is reflecting at least one actual method?)

The problem is that no matter what I do, the @AfterReturning method is never called. I don't know what's wrong, it was based on the "Spring in Action 3rd edition" book example and I don't think the modifications had any significance (mainly names).

The "MyService.performOperation(..)" method is @Transactional, if matters.

- are the classes containing the methods you want advised properly registered as Spring beans? Spring AOP only works on Spring beans...

- if yes, are the beans registered in the SAME application context where the aop configuration is defined? Parent/child context access rules don't work for AOP...

- if yes, are the methods you want advised public, non-static, and called externally(i.e. not inside the class itself)? Because Spring AOP is proxy based, non-public, static or only called internally methods can't be advised.

If the answer is yes for all questions, them the only possible problem remains the interaction with the tx config, so you should also post that part of your configuration...

Comment

I wasn't aware of the fact that internal calls are not being advised, and indeed that method was public non-static but called internally. So I had to export it out to another class just to comply with AOP requirements but now it works. Thanks!