So long as you have no code that has @Inject Injector (and then later calls .getInstance(Something.class), because Guice can't statically detect that), then calling Guice.createInjector(MyModule(), Stage.TOOL) should fail if you're missing dependencies.
sam On Thu, Oct 16, 2014 at 3:31 PM, Kevin Burton <[email protected]> wrote: > I don't follow.. I can't parse your sentence. > > On Thursday, October 16, 2014 11:03:36 AM UTC-7, Sam Berlin wrote: >> >> If you don't inject the injector anyway, wouldn't creating the injector >> (in Stage.TOOL if you want to prevent creating anything) cover this? >> >> sam >> >> On Thu, Oct 16, 2014 at 2:00 PM, Kevin Burton <[email protected]> wrote: >> >>> Is there an easy way to require that your dependencies are met without >>> actually having to call getInstance or have an instance of an object? >>> >>> This should be easy since I can build a graph of the connections between >>> Classes. >>> >>> Some of my instances require complex init and external dependencies like >>> Cassandra and ActiveMQ... I don't to have to require these in my unit tests >>> because they are hefty. >>> >>> I'd like to inject Session which is a Cassandra object bound to a given >>> connection... but of course I would have to create that object manually. >>> >>> Is there a cleaner way to do this? >>> >>> This way I could have some basic tests for production bindings to make >>> sure the bindings are complete and all dependencies met. >>> >>> -- >>> 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/1e68a134-5614-446f-9463-6a500c8f7ca2% >>> 40googlegroups.com >>> <https://groups.google.com/d/msgid/google-guice/1e68a134-5614-446f-9463-6a500c8f7ca2%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> -- > 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/df13a3d1-b50c-4e0e-aad7-ff27bc8cff9a%40googlegroups.com > <https://groups.google.com/d/msgid/google-guice/df13a3d1-b50c-4e0e-aad7-ff27bc8cff9a%40googlegroups.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > -- 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/CAJEBNUfgSBQpyv_nwfGuU8iEEPDbVVA6BVFT3XSnXpigo--bpw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
