title: Guice Custom Injection for constructor parameters
body: <p>I read about Custom Injection in Guice here: 
  <a href="https://github.com/google/guice/wiki/CustomInjections" rel="noreferrer">https://github.com/google/guice/wiki/CustomInjections</a></p>
  
  <p>This scheme describes how you can create a MembersInjector for injecting fields of a class. I am able to do this successfully. However, I do not like the idea of field injection and would like to do this to inject parameters of a constructor.</p>
  
  <p>Does anybody have a clue as to how this can be achieved for constructor injection?</p>
  
  <p>Specifically:</p>
  
  <pre><code>public class PaymentService {
    private final Logger logger;
  
    @Inject public PaymentService(@InjectLogger(type="log4j") final Logger logger){
         //the @InjectLogger is the injection point
    }
  
  
    ...
  }
  </code></pre>
  
  <p>The documentation of MembersInjector says "inject dependencies into fields and methods of type T": <a href="http://google.github.io/guice/api-docs/latest/javadoc/index.html?com/google/inject/MembersInjector.html" rel="noreferrer">http://google.github.io/guice/api-docs/latest/javadoc/index.html?com/google/inject/MembersInjector.html</a></p>
  
  <p>This seems to indicate that it should be possible to do this.
  Any ideas?</p>
  
  <p>Also, to clarify, I need to use custom injection because I don't have the binding at development time. I have to bind a logger at runtime based on the attribute in my annotation from a configuration. I also cannot iterate through all my config keys.</p>