title: Guice: inject dependency into @provides provider
body: <p>I have a module in which I create a provider and that provider is needed as a dependency for another provider in the same module. However, this is not currently possible with my setup. How can I solve this issue? It should also be noted that all the dependencies are third party libraries and so I believe that I should not be binding this in my module (according to what Ive read).</p>
  
  <p>Unfortunately, due to NDA I cannot provide the actual code, but an example of the dependency hierarchy can be seen below:</p>
  
  <pre><code>public MyModule extends AbstractModule {
      @Override
      protected void configure() {}
  
      @Singleton
      @Provides
      public Engine provideEngine(){
          Map&lt;String, String&gt; engineProperties = new HashMap&lt;&gt;();
          engineProperties.put("brand", "some brand");
          engineProperties.put("capacity", "2.6 litres");
          return new Engine(engineProperties);
      }
  
      @Inject
      @Provides
      public Car provideCar(Engine engine){
          Car car = new Car(engine);
          return car;
      }
  }
  </code></pre>
  
  <p>Is short, I need to create a custom Engine, setting up some properties before hand and then use that Engine as a dependency for the Car creation (please note that i am fully aware that I cannot inject using the @Inject annotation in the module, however, I put this simply as a reference to what I want to achieve).</p>