If you are using Swing or JFX i don't see other way to inject the services and other things when you need...
at., *Arthur P. Gregório* *+55 45 9958-0302* @gregorioarthur www.arthurgregorio.eti.br 2013/4/13 Cédric Beust ♔ <[email protected]> > Ideally, your main() should be the only place you ever see an Injector, > and sometimes, you don't even have one at all (e.g. using a servlet > container that does the injection for you). > > In practice, you might have to materialize that injector in a few specific > places in your application where, for some reason, injection is not > available, but these situations should be rare and you should make sure you > have no other options. > > -- > Cédric > > > -- > Cédric > > > > On Sat, Apr 13, 2013 at 6:59 AM, Jozsef Hegedus <[email protected]>wrote: > >> Hi, >> >> I recently started to learn Guice. Let's consider this example from >> https://code.google.com/p/google-guice/wiki/Motivation . >> >> public static void main(String[] args) { >> >> >> Injector injector = Guice.createInjector(new BillingModule()); >> >> >> BillingService billingService = >> injector.getInstance(BillingService.class); >> >> >> ... >> } >> >> >> This makes me think about : >> >> Is it a good practice to create one injector per application (in a static >> field) and then make that globally available via a public static method ? >> >> Then use that injector instance everywhere instead of new (given that >> there are no circular dependencies) ? >> >> Cheers, >> >> Jozsef >> >> -- >> 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. > > > -- 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.
