title: Binding the same interface twice (Guice)
body: <p>My classes (let call them <code>X</code> and <code>Y</code>) both implementing <code>Parser</code> interface do (relatively) CPU intensive operations to build parsers for certain syntaxes (different syntaxes for <code>X</code> and <code>Y</code>).</p>
  
  <p>Now I want to inject (with Guice) dependencies of both <code>X</code> and <code>Y</code> into constructor of an (upper level) parser <code>P</code>. Both arguments of <code>P</code> should be of the type <code>Parser</code>:</p>
  
  <pre><code>class P implements Parser {
  
      @Inject
      public P(Parser x, Parser y) {
          // ...
      }
  
  }
  </code></pre>
  
  <p>How can I make Guice to differentiate which of the two arguments of <code>P</code> shall receive <code>X</code> and <code>Y</code>?</p>
  
  <p>As you understand, <code>X</code> and <code>Y</code> should be annotated <code>@Singleton</code> (but this note seems unrelated with the question).</p>