This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
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 The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Spring AOP" Watch "Spring AOP" New topic
Author

Spring AOP

Shiaber Shaam
Ranch Hand

Joined: Jun 16, 2006
Posts: 252
I have a non Spring web app. I want to implement Spring AOP for some of the methods in our app. Those methods are not invoked using Spring Beans at all. Is there anyway we can do this? I would appreciate if someone can provide me with a sample.


$Hi/\bEr
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

Shiaber Shaam wrote:I have a non Spring web app. I want to implement Spring AOP for some of the methods in our app. Those methods are not invoked using Spring Beans at all. Is there anyway we can do this? I would appreciate if someone can provide me with a sample.


Spring AOP can only advice objects that are Spring Beans. Because it creates DynamicProxies at runtime in the Initialization phase of Spring's ApplicationContext container. And that container only knows about beans you added in Spring configuration (xml, Annotations, or Java Config way)

If you want to get AOP into code you can always just use an AOP framework like AspectJ and do bytecode instrumentation.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
 
Don't get me started about those stupid light bulbs.
 
subject: Spring AOP