I have been developing Swing application using Guice and it worked very
well.

There is no problem with performance caused by lazy loading, because with
Guice, one can inject Provider<T> instead of T itself, so I used it all the
time when lazy loading was required.

Regards,
Witold Szczerba


On 10 March 2013 22:30, Tim Boudreau <[email protected]> wrote:

> On Monday, February 4, 2013 9:00:44 AM UTC-5, Satish Pokhrel wrote:
>
>> Actually what is found that all swing components much run on EDT ? will
>>> guice allow to create object which runs inside that single thread ..
>>>
>>
> I've contemplated that problem a time or two, and I think what you really
> want to enforce that is a custom Scope which represents the Swing event
> thread, and then bind your types within that scope, so that injecting them
> on any other thread results in an error.
>
> That said, I'm not sure that Guice's model for dependency injection is
> that good a fit for Swing.  GUI application performance benefits a lot from
> lazy-loading;  DI is all about creating the closure of an object's
> dependencies at construction-time - the opposite of lazy-loading.  So, if
> you have a panel, and that panel *might* need to show an error dialog, it's
> not really the best idea to, say, pass an error dialog into that panel's
> constructor just in case.
>
> Now, my background is *huge* Swing applications (NetBeans), and you
> probably *could* make Guice work nicely in something small.  But in general
> (and I know this will be anathema to some here), the service locator
> pattern is a better fit for Swing applications.
>
> -Tim
>
>  --
> You received this message because you are subscribed to the Google Groups
> "google-guice" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/google-guice?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-guice?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to