Search code examples
gwtgwt-2.4

Dependency Injection in GWT or of Spring


I am new GWT. I have a project where I am using GWT and Spring as our technologies to implement. I have done Spring integration with GWT, with the help of following links. http://technophiliac.wordpress.com/2008/08/24/giving-gwt-a-spring-in-its-step/ https://docs.google.com/document/pub?id=1USHYx9cB3B1s1zM4dlkzEZ759D3lEfavn_dDewvBkaA Here with this, I am able to apply the Dependency Injection with only Server side classes which holds the actual business(Remote Service) functionality.

My questions are,

  • How can i apply Dependency Injection for all other classes like those are in client, shared, view, presenter packages?

  • Which dependency Injection is better? I mean GWT provided two dependency injection mechanisms

    1. guice is for implementing dependency injection on server side

    2. gin is for implementing dependency injection on client side.

    3. and Spring Dependency Injection.

    Which one is better to select? either GWT Dependency Injection or Spring Dependency Injection? or combination of both?

Please reply me.

Thanks,

Saritha.


Solution

  • Spring is not supported for GWT so you have to use GIN for the client side.

    Combine Guice and Spring on the server-side makes no sense, because Spring managed beans are not compatible to Guice managed beans.

    So you have to ask yourself which DI framework you want to use on the server side. Both do a very good job. Guice is more ligthweight and Spring offers a lot of additonal modules.

    I don't see any advantages using Guice on the server side because of the fact that your are using GIN on the client side.