Results 1 to 3 of 3

Thread: Do we need Spring on client side when we have AspectJ?

  1. #1
    Join Date
    Jun 2005
    Location
    Dallas, Texas
    Posts
    19

    Default Do we need Spring on client side when we have AspectJ?

    I had posted this before, but never got a response.... anyone care to comment?

    Recently I've been learning AspectJ and find it extremely powerful. It seems that all the Dependency Injection and AOP I could ever imagine can be done with only a few lines of code! Just as a proof of concept, I created a WireFramework aspect that can inject anything I want into any instance just created without changing the parent class. With the power of AspectJ to help you build rich client applications, why bother with trying to get Spring loaded? I can see that a great deal of work is done for you by Spring on the server side, but now I question the utility of spring on the client side.

    I would enjoy reading everyone's thoughts!

  2. #2
    Join Date
    Aug 2004
    Location
    Southampton, UK
    Posts
    826

    Default

    AspectJ provides some excellent mechanisms for hooking into the creation of an object so you can inject some objects into it. However, it doesn't provide any framework features that actually help with the rest of the DI puzzle.

    Creating an aspect every time you want to configure a given object type would seem pointless - rather what you need is generic aspect that allows you to configure any object with a set of collaborators that are configured externally. This external configuration should allow for complex graphs of collaborators and provide the ability to locate collaborators from a variety of locations. This is the kind of funcitonality the Spring and AspectJ team have been working on ready for the Spring 1.3 and AspectJ 5.0 releases.

    Using this new functionality, you will be able to define configurations for your objects using Spring, and have AspectJ invoke Spring to do the wiring every time an instance of one of your objects in instantiated. This gives you the best of both worlds - you are free to create objects as you need in your code plus you get a sophisticated and fully decoupled DI implementation.

    Regards,

    Rob
    Rob Harrop
    Lead Engineer, dm Server
    SpringSource
    http://www.springsource.com

    Co-Author - Pro Spring

  3. #3
    Join Date
    Jun 2005
    Location
    Dallas, Texas
    Posts
    19

    Default

    Are you saying that the real selling point of using spring on the client side is for dependency injection using an external configuration (ie. context.xml files)?

    That's a tough sell! I can use one very small aspect to wire all of my swing components (etc.) together. If I have to use an IDE to build the application to begin with, why do I need the external configuration?

    I am very excited about AspectJ 5.0 and Spring 1.3. Both these projects are making leading breakthroughs! Also - Good job on your book!

Similar Threads

  1. Spring, Remoting and Spring Rich Client
    By shaby775 in forum Swing
    Replies: 9
    Last Post: Jan 6th, 2011, 07:30 AM
  2. Closer ties between Spring and AspectJ
    By Rod Johnson in forum Announcements
    Replies: 3
    Last Post: Sep 7th, 2005, 10:26 AM
  3. JaxRpc client side authentication.
    By ervandew in forum Security
    Replies: 3
    Last Post: May 18th, 2005, 12:00 PM
  4. Replies: 14
    Last Post: Feb 21st, 2005, 05:41 PM
  5. Replies: 16
    Last Post: Nov 19th, 2004, 09:36 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •