Announcement Announcement Module
No announcement yet.
Relationship between IoC and AOP Page Title Module
Move Remove Collapse
This topic is closed
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Relationship between IoC and AOP


    I was wondering whether or not there is a relationship between IoC and AOP. It seems like dependency injection can be achieved through introductions in AOP, but I am not competent enough in AOP to try it out. Or, are they completely different principles? Does anyone have any information regarding this topic?


  • #2
    I think they're best considered as separate principles. Both, however, in combination, can help to keep framework dependencies out of application code--one of the major goals of Spring.

    Spring uses IoC to configure AOP framework objects such as pointcuts and interceptors. E.g. MethodInterceptors are configurable themselves by Dependency Injection.

    Spring uses AOP primarily to deliver declarative services such as transaction management. However it's AOP framework allows the authoring and use of sophisticated custom aspects, as described in the Reference Manual.

    There's a lot of material about IoC and AOP and how they relate in "J2EE without EJB".


    • #3

      Interesting, thanks for the reply. "J2EE without EJB" sounds like a really informative book.


      • #4
        Read it and have fun. I read the book in one session. It provides much value. You will love it!

        For further reading about AOP you may read 'AspectJ in Action'. I think the book is one of the most complete and most easy to follow introductions to AOP in general and AspectJ in special. It is a really mind-opener.

        I am not using AspectJ that often, since the Eclipse plugin isn't that complete today. I really got that feeling they screwed us with Lancaster. :-(

        By the way:

        Thanks Rod for sharing your insides! The book filled some holes and also made me think about certain problems. Many thanks!