title: Injecting specific instance with Guice
body: <p>I'm having a few problems injecting a specific field instance with Guice.</p>
  
  <p>Here's what I currently have:</p>
  
  <pre><code>class Driver {
     private ThreadLocal&lt;Database&gt; db;
  
     ...
  }
  </code></pre>
  
  <p>I'd usually just pass the db instance in a constructor. But this class will be intercepted, using guice.</p>
  
  <p>Here's the module:</p>
  
  <pre><code> class MyGuiceModule extends AbstractModule {
  
      private ThreadLocal&lt;Database&gt; dbToInject;
  
      public MyGuiceModule(ThreadLocal&lt;Database&gt; dbToInject) {
           this.dbToInject = dbToInject;
      }
  
      @Override
      protected void configure() {
  
           // Binds the interceptor.
           bindInterceptor(....);
  
           bind(ThreadLocal.class).toInstance(this.dbToInject);
      }
   }
  </code></pre>
  
  <p>And here's how I'm instantiating all the stuff:</p>
  
  <pre><code>Injector injector = new Injector(new MyGuiceModule(db));
  Driver driver = injector.getInstance(Driver.class);
  </code></pre>
  
  <p>I bet it's pretty obvious, but what am I doing wrong here?</p>
  
  <p>EDIT:</p>
  
  <p>Sorry if I wasn't clear. My problem is that this is not working. The instance is not being injected. I've annotated the field with @Inject and still doesn't work.</p>