|
From: Rod J. <rod...@in...> - 2004-06-28 18:19:00
|
All I did a lot of work over the weekend on integrating Spring/AspectJ. After the factory method IoC enhancement (which was motivated largely by AspectJ integration, although it's otherwise useful), this hasn't required more changes to the implementation of Spring: just experimentation with how things work out in practice. The fruit of this effort is in the new "samples" module, under the aspectj directory. This is an Eclipse AspectJ project, with two sub-projects: teacher and bank. Teacher is based on Adrian Colyer's girl/boy/teacher example, which he featured on his blog shortly after TSS Symposium. Thanks to Adrian for solving the basic problem in Spring/AspectJ integration: how to configure aspects using Dependency Injection. (Note btw the use of the "depends-on" attribute to ensure that an aspect is configured before it's used. The special aspect initialization bean Adrian's code used is not required.) Bank is a new example, showing a few scenarios relevant to enterprise usage. It's based around a Bank interface managing fine-grained Account objects. It uses AspectJ to advise those objects, with aspects configured using Spring DI. Advising fine-grained objects is a problem that proxy-based solutions such as Spring's own AOP framework are not well suited to addressing. AspectJ is perfect here. I'm currently working on some more esoteric features, such as getting Spring to configure "perthis" aspects, but the essential Spring/AspectJ integration is in place. I'll be adding to and polishing the code in the samples module over the next few weeks, with the aim of releasing it as a separate sample download some time in July. I think that integration with AspectJ is going to benefit many Spring users. This is going to be one of the major new features of Spring 1.1. I encourage users interested in AOP to check it out, and feed back comments or contributions. Btw there is no conflict with using AspectJ and Spring's own AOP framework in the same application. Currently there are no build scripts in the aspectj sample--it relies on Eclipse. Any contribution of a build script will be gratefully received! Rgds Rod |