• 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

AOP ambiguous situation

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I had a scenario like i need to log the statements for method start and end of each and every public method.

I had opted for spring AOP as it suits my requirements best..


Now i had flow like this



I used CGLib for proxy. so i had added thsi statement to my beans-config.xml




Now the problem is i can see logs for Builders,Delgators and DAOs only.

is it due to Controllers implementing something and rest not ?

Could any body please help me how to overcome this...?

i need the log statements to be printed for all the layers...

Many thanks in advance
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Depends on your pointcut expression, and/or which xml file you have it in. So those classes you mentioned that it is working is in an ApplicationContext object, and the Controller's are loaded in a different context. so they aren't together. I am suspecting the applicationContext has your Aspects defined in them. Whereas the xml file that defines your Controller classes does not.

Mark
 
Shivaji Byrapaneni
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No im using multi action form controller and it is the only controller that i had and i had imported all the other xmls using import statemnt on top

 
Mark Spritzler
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Shivaji Byrapaneni wrote:No im using multi action form controller and it is the only controller that i had and i had imported all the other xmls using import statemnt on top



I didn't say a particular type of Controller, just Controller.

Anyway, in the Web, you have two different contexts. One for the web and a parent ApplicationContext. Your services are in the parent ApplicationContext as well as your AOP Aspects. The Controller is in the web AppContext. The controller can inject and get beans from the parent ApplicationContext, but not the other way around, so the AOP Aspects can't see or do anything with your Controller. The parent Application Context is created first, with its lifecycle. Then the Web context is created with your Controller created, way after the AOP proxies for your Aspect have been created.

Hope that helps clarify it for you.

Mark
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic