Aug 14th, 2004, 03:04 PM
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?
Aug 15th, 2004, 06:51 AM
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".
Aug 15th, 2004, 04:18 PM
Interesting, thanks for the reply. "J2EE without EJB" sounds like a really informative book.
Aug 15th, 2004, 04:52 PM
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!