• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Spring AOP

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Great reply .....
Thank you very much for quick respond. i ll give a try .....
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic