This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
Spring AOP itself supports DI/IOC, then why we need AspectJ inegration with Spring AOP. Actually i am planing to use Spring AOP for my application Transaction, can i integegrate AspectJ with Spring AOP (or) just Spring AOP supports Transaction using IOC/DI.
You don't actually need to use AspectJ. Spring AOP should be enough in most cases. From the reference documentation :
Spring AOP currently supports only method execution join points (advising the execution of methods on Spring beans). Field interception is not implemented, although support for field interception could be added without breaking the core Spring AOP APIs. If you need to advise field access and update join points, consider a language such as AspectJ.
Spring AOP's approach to AOP differs from that of most other AOP frameworks. The aim is not to provide the most complete AOP implementation (although Spring AOP is quite capable); it is rather to provide a close integration between AOP implementation and Spring IoC to help solve common problems in enterprise applications.
Thus, for example, the Spring Framework's AOP functionality is normally used in conjunction with the Spring IoC container. Aspects are configured using normal bean definition syntax (although this allows powerful "autoproxying" capabilities): this is a crucial difference from other AOP implementations. There are some things you cannot do easily or efficiently with Spring AOP, such as advise very fine-grained objects (such as domain objects typically): AspectJ is the best choice in such cases. However, our experience is that Spring AOP provides an excellent solution to most problems in Java EE applications that are amenable to AOP.
Spring AOP will never strive to compete with AspectJ to provide a comprehensive AOP solution. We believe that both proxy-based frameworks like Spring AOP and full-blown frameworks such as AspectJ are valuable, and that they are complementary, rather than in competition. Spring 2.0 seamlessly integrates Spring AOP and IoC with AspectJ, to enable all uses of AOP to be catered for within a consistent Spring-based application architecture. This integration does not affect the Spring AOP API or the AOP Alliance API: Spring AOP remains backward-compatible.
The beans which become targets to AOP aspects are proxied by Spring. This is done without you knowing it. You still get your beans via their interface, as if nothing happened. But you are actually using a proxy implementing your interface, which does all the cool aop stuff behind the scenes. Check this Journal article.
Joined: Apr 08, 2004
Spring Framework's AOP functionality is normally used in conjunction with the Spring IoC container
Can i use Spring AOP with Spring Application Context(framework oriented way - XML approach)? Spring AOP only works with Spring IOC container?