• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Spring/AspectJ vs Spring AOP

 
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We are prototyping a new system. We are using Spring. And we are using AOP.

According to Rod Johnson in his book J2EE Development Without EJB, he would recomend using Spring's implementation of AOP. But this book is an old 2004 book.

Spring's version is nice because it uses Java interfaces and it seems easier to implement. One downer is that it is a run-time implementation. But I am not sure we need anything more. And we are already locked into using Spring.

The other option is AspectJ. It is a more full implementation of AOP. It is a compile time implementation. But the code is not Java. I have heard that Spring is now recommending, or at least indirectly suggesting, that you use AspectJ in its 2.x releases (2.x has new build in support for AspectJ??).

I know which implementation of AOP you use greatly depends on your project's requirements.

My questions:
1. Based on your experience, do you automatically use one or the other?
2. Is Spring now shifting away from its own implementation and recommending AspectJ? I have not found anything that supports that yet.
3. Have you run into any problems using Spring's AOP implementation?
 
Ranch Hand
Posts: 775
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I can speak to #3, no comments on the two. No, no problems so far. I like it. Nifty way to graft in useful code that otherwise would really obscure what is going on in some classes.

Clearly Spring AOP functionality is a subset of AspectJ functionality. I suspect a day may come when I graduate from one to the other, but no rush at the moment. Maybe someday I'll find another IOC container whose implementation I prefer over Spring but doesn't come with AOP and will switch to AspectJ then, but in the meantime I like it.
 
Ranch Hand
Posts: 451
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Rusty,

Actually Spring and AspectJ versions are highly complementary. Those using Spring AOP find it easy to configure and tend to appy it to coarse-grained service type objects like business layer facade implementations. AspectJ can do the same thing but also proxy fine-grained domain objects. It also has a much more powerful but more difficult to learn pointcut syntax. Spring is NOT moving away from its own versions as both are useful for different things.

Spring 2.0 now has much tighter integration with AspectJ and supports its pointcut syntax as well as its own simple Ant style and Regular Expression pointcut syntaxes. There is also now an AspectJ specific extension of the beans configuration XML that makes it easier to setup and wire aspects into your system. Spring's new XML syntax is now based on a schema instead of a DTD which allows others to extend the syntax in an application specific way. Both AOP frameworks also support Java 5 annotations.

For those just getting started with AOP, Spring's pointcut syntax provides an easy way to get up to speed.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic