Wednesday, October 26, 2016

How to bind essential singletons in multi-module GIN app and avoid duplicate binding

[ Original post on StackOverflow http://stackoverflow.com/questions/40132219/how-to-bind-essential-singletons-in-multi-module-gin-app-and-avoid-duplicate-bin ]

It's a simple selfdescriptive question (subj).

Anyway, just to give an example. We have a main app module and some visual components module (some reusable module for many apps), both constructed with GIN. Needless to say, that such instances as EventBusScheduler etc. are usually bound as singletons and they get injected here and there. So, if we consider the aforementioned visual components module as a somewhat independent instance, which requires minimum work on a part of a client to get it inherited, then it should contain its own GIN configuration module, where it binds those singletons - same the main app configuration module usually has. And the compiler obviously won't let duplicates to coexist.

What's the best practice to avoid such a duplication conflict.

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment