Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Spring AOP

 
Shiaber Shaam
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
  • 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.
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic