aspose file tools*
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 EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Spring AOP" Watch "Spring AOP" New topic
Author

Spring AOP

Saman Sauron
Greenhorn

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="org.springframework.aop.support.RegexpMethodPointcutAdvisor">
<property name="patterns">
<list>
<value>com.test.application.*.dao.*</value>
</list>
</property>


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.


<list>
<value>com.test.application.*.dao.*.save*</value>
</list>
<list>
<value>com.test.application.*.dao.*.add*</value>
</list>

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

Joined: Nov 24, 2005
Posts: 14687
    
  16

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
Greenhorn

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: http://aspose.com/file-tools
 
subject: Spring AOP
 
Similar Threads
AOP Spring
Metaphors of AOP
AOP
Spring AOP, How does this example do it?
How to Use Spring AOP for Auditing?