title: Guice injector.getInstance() - good practice?
body: <p>Let's say I have two applications sharing the same library. This library contains common classes like DAOs, Utils, etc. Everything in the shared library is wired with Guice. My two apps depend on this library but do not have a direct dependency on Guice. </p>
  
  <pre><code> ______    ______    ______
  |      |  |      |  |      |
  | APP1 |-&gt;| LIB  |&lt;-| APP2 |
  '------'  '------'  '------'
  </code></pre>
  
  <p>I currently use something like this:</p>
  
  <pre><code>static &lt;T&gt; Utils.getInstanceOf (Class&lt;T&gt; type);
  </code></pre>
  
  <p>which is simply a wrapper for:</p>
  
  <pre><code>injector.getInstance (Class&lt;T&gt; type);
  </code></pre>
  
  <p>But the guice docs say: </p>
  
  <blockquote>
    <p>When feasible, avoid using this method, in favor of having Guice
    inject your dependencies ahead of time.</p>
  </blockquote>
  
  <p>So what's the best way to provide dependency injection for the two apps without having to manually bind them in a Guice module?</p>