title: How do I reuse an existing instance of an object in Google Guice?
body: <p>I am new to Google Guice. As of now, it seems that every time a new binding is created, a new object is created. If you have two of the same object as a constructor parameter (or field, etc) in two different classes, how do you reuse first instance of the object as the second object's constructor argument? For example:</p>
  
  <pre class="lang-java prettyprint-override"><code>public interface MyInterfaceA{
      //Method declarations
  }
  </code></pre>
  
  <pre class="lang-java prettyprint-override"><code>public class MyClassA implements MyInterfaceA{
      private MyInterfaceC myField;
  
      @Inject
      public MyClassA(MyInterfaceC myField){
          this.myField = myField;
      }
  
      //Methods, etc.
  }
  </code></pre>
  
  <pre class="lang-java prettyprint-override"><code>public interface MyInterfaceB{
      //Method declarations
  }
  </code></pre>
  
  <pre class="lang-java prettyprint-override"><code>public class MyClassB implements MyInterfaceB{
      private MyInterfaceC myField;
  
      @Inject
      public MyClassB(MyInterfaceC myField){
          this.myField = myField;
      }
  
      //Methods, etc.
  }
  </code></pre>
  
  <pre class="lang-java prettyprint-override"><code>public interface MyInterfaceC{
      //Method declarations
  }
  </code></pre>
  
  <pre class="lang-java prettyprint-override"><code>public class MyClassC implements MyInterfaceC{
  
      @Inject
      public MyClassC(){
          //Implementation
      }
  
      //Methods, etc.
  }
  </code></pre>
  
  <pre class="lang-java prettyprint-override"><code>public class MyModule extends AbstractModule{
      @Override
      protected void configure(){
          bind(MyInterfaceA.class).to(MyClassA.class);
          bind(MyInterfaceB.class).to(MyClassB.class);
          bind(MyInterfaceC.class).to(MyClassC.class);
      }
  }
  </code></pre>
  
  <p>In this example, I think that MyClassA's constructor is called via Guice with a new instance of MyClassC, and MyClassB's constructor is also called with a new instance of MyClassC. How would I first call MyClassA's constructor with a new instance of MyClassC, but then MyClassB's constructor with that same instance of MyClassC with Guice?</p>