File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Spring AOP

 
Saman Sauron
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Saman Sauron
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic