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.

after returning advice

Nov 12th, 2008, 04:59 PM

This is my first attempt at implementing Spring's AOP. What i am looking to do is to use an after returning advice when a method successfully executes. In context to what I am trying to accomplish. I want to send emails as soon as someone signs up in our system.
Please look at my attachment for the code example that i am using

The same configuration works as a standalone java project with Spring.jar added to it. What am i doing wrong here? been stuck with this for the last day or so.

Comment

1. I did try .* instead of the (".") and I couldn't get it to work.
2. The reason for using the RegexpMethodPointcutAdvisor was to match .*insert.* method in my service. I apologize for not being clear on that part.
3. Taking advantage of Spring 2.x to configure aspects threw an exception
nested execption is java.lang.NoClassDefFoundError: org/aspect/weaver/BCException which says that i don't have the aspectJ dependency added. I was trying to take advantage of Spring's native implementation of AOP (i think it uses a part of AspectJ). Please correct me if I am wrong.

Further searching and reading lead me to this configuration which worked.

Comment

Your initial config worked fine for me after changing '*' to '.*'. It's absolutely unclear what did you have from 'I did try .* instead of the (".") and I couldn't get it to work';

BeanNameAutoProxyCreator is related to the old spring aop. I suggest you to follow spring team recommendation and use new aop config facilities;

If you have a problem with AOP create small standalone test-case that reproduces the problem and post it here. It's not possible to understand how to fix your problem if there is no even problem description;