BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News InfoQ Article: Simplifying Enterprise Apps with Spring 2 and AspectJ

InfoQ Article: Simplifying Enterprise Apps with Spring 2 and AspectJ

Spring has long provided a proxy-based service to apply Aspects to Spring-managed beans. However, when it comes to requirements that impact multiple points in your domain model, Spring AOP is of much less assistance, but AspectJ is a natural fit.  AspectJ aspects don't need any special proxy creation, and can happily advise objects created at runtime either in your application code or by frameworks you may be using. AspectJ is also a very good solution when you want to modularise behaviour that cuts across all the different layers of your application, or that is in any way performance sensitive.

Adrian Colyer, AspectJ lead and Chief Scientist at Interface21 has contributed an excellent article which shows how to use Spring 2's new AspectJ integration features followed by a roadmap for the adoption of Aspect Oriented Programming on an enterprise project, with lots of specific examples of how and where to apply Aspects.

Adoption of AOP can proceed in a number of phases: start out by taking advantage of aspects that Spring supplies out-of-the-box, and then you can add your own @AspectJ aspects using Spring AOP in the web, service, and data-access layers. AspectJ itself can be used to improve development productivity without introducing any runtime dependency on AspectJ. Going further, infrastructural requirements that cut across multiple layers of your application can be simply implemented using AspectJ aspects. Finally, you can use aspects to simplify the implementation of your domain model itself.
Read Simplifying Enterprise Apps with Spring 2 and AspectJ.  See also infoq.com/spring, infoq.com/aop

Adrian is also speaking at The Spring Experience, along with the rest of the spring experience.

Rate this Article

Adoption
Style

BT