• 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

Problem with Spring AOP+AspectJ

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all! I want to log every invoke public method in my class. So, i create LoggingAspect class for logging, and configure Spring on xml.
When i start my application, all methods logging three times, for example:

Entering method selectAllCompanies...
Entering method selectAllCompanies...
Entering method selectAllCompanies...


Really, methods invokes one times. I think, that problem in a pointcut, but i'm not sure.

aop-context.xml


LoggingAspect.java
 
Bartender
Posts: 1682
7
Android Mac OS X IntelliJ IDE Spring Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think this is fixed in newer versions of Spring.

Your problem I believe is that other proxying is being done on your DAO (Transactional etc) and your advice is being called multiple times before the actual POJO is invoked.

See if this link helps you at all.

http://forum.springframework.net/showthread.php?5528-Advice-called-multiple-times-when-using-AttributeMatchMethodPointCut

Thanks,
 
Anderson gave himself the promotion. So I gave myself this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic