GWT wiring via Spring…

I have a more detailed post in the works, but until then, let’s just say using Spring to wire your GWT components is ridiculously easy. I ran into some issues, but thanks to a post from pgt, I was able to work through them.

In short, write your GWT-Dispatch (gwtd) and GWT-Presenter (gwtp) code (Actions, Results, ActionHandlers, etc) as you normally would. I prefer setter-based injection, so I make sure my dependencies all have public setters. Once your code is structurally ready, add Spring @Component annotation to the classes that will require DI. Next, add the @Autowire annotation to the to-be injected setters/fields. I kid you not, it’s that simple.

With that said, the real work is knowing what and how to define your Display interfaces. It’s more UI abstraction than I’m used to. Regardless, it’s worth it – really makes testing the UI easy.

This entry was posted in GWT. Bookmark the permalink.

2 Responses to GWT wiring via Spring…

  1. Sony Mathew says:

    This looks like wiring on the server-side only. i have to say these concepts of execute & Action are so Ugggh…haven’t used them in a long time.

  2. Jay says:

    Well, it’s server-side if you’re keen on using Spring. If you’re open to Gin, injecting client-side dependencies is NOT a problem.

    I’m just slow to adopt… 🙁

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.