File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Spring and the fly likes Spring AOP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Spring AOP" Watch "Spring AOP" New topic

Spring AOP

Saman Sauron

Joined: Jul 06, 2010
Posts: 7
Hi this is my first post here ......

I want to intercept all the DAO method which used to inset and update records in my application. So i used spring AOP. Evey thing went fine except defining the correct method structure pattern.

<bean id="customerAdvisor" class="">
<property name="patterns">

The above regx pattern will intercept all the method of the all the classes in the dao (com.test.application.*.dao.) package. but i just want to intercept the methods starting from add and save only. So when i used the following it was not working.


Can anybody printout the issue here ?? Thank you
Christophe Verré

Joined: Nov 24, 2005
Posts: 14688

Assuming you are using the JDK regex matching, use "com\\.test\\.application\\..*\\.dao\\..*(save|add).*".
This will match any methods starting with "save" or "add", under the "com.test.application.XXX.dao" package, where XXX is anything.

[My Blog]
All roads lead to JavaRanch
Saman Sauron

Joined: Jul 06, 2010
Posts: 7
Great reply .....
Thank you very much for quick respond. i ll give a try .....
I agree. Here's the link:
subject: Spring AOP
jQuery in Action, 3rd edition