• 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
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Spring AOP

 
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
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

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
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic