tags:

views:

299

answers:

3

I want to use an AOP framework, but I have two constraints.

Any framework that I choose

  1. Must be fairly independent. I plan to use this in a legacy code base, and hence cannot upgrade prospective dependencies like commons-logging-XXX.jar to commons-logging-newest.jar.

  2. Must be fairly well documented, should not be too complex to understand and integrate.

+3  A: 

AspectJ as far as I can tell is just a compiler and imposes no dependencies on compiled programs other than including the AspectJ runtime jar.

It is also actively maintained, part of the Eclipse project and has a nice development environment (AJDT, a plugin to Eclipse).

Aaron Maenpaa
A: 

Okay, this one doesn't fit all your requirements, but I think, it's worth a look: http://dynamicaspects.sourceforge.net/

Positives

  • No dependencies except needs java 1.5 due to using the JavaAgent
  • No XML markup needed and just works with POJO classes
  • Tried myself and found it very easy to use (not very complex)

Negatives

  • No more activly maintained afaik
  • Poor documentation
  • You cannot do everything a full fledged AOP framework allows you to do

I tested it out some time ago and was pretty impressed but found some glitches which I don't remember right now. Though you might give it a try.

Greetz, GHad

GHad
+1  A: 

I like Spring + AspectJ. You can do all of your pointcut definitions in xml if you like, and you don't need to change a line of code on your legacy stuff. If you already know spring and AOP concepts, there's not much to learn.

Miguel Ping
The only thing I am worried about Spring AOP, is the number of dependecies it has.
swapnonil