>
> Thanks,
> It seems that using a Provider throwing unchecked exceptions and manually 
> calling injector.getInstance(...) right after createInjector on my 
> top-level services allows me to initialize and validate my configuration on 
> Startup. 
>

FYI, a slightly nicer pattern for that is something like

bind(SanityChecker.class).asEagerSingleton();

static class SanityChecker {
   @Inject
    SanityChecker(Service1 one, Service2 two) {}
}

That way, the sanity check is part of your module, and if someone reuses 
it, everybody who reuses it doesn't have to remember to ask the injector 
for anything that might break.

-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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-guice/e89a2611-5540-4d6f-aca3-12fa6dbe0072%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to