title: Dagger: Inject @Named strings?
body: <p><strong>EDIT</strong> 2018-02-08:  Sample project demonstrating how to do this at <a href="https://github.com/ravn/dagger2-named-string-inject-example" rel="noreferrer">https://github.com/ravn/dagger2-named-string-inject-example</a> - Note: <a href="https://github.com/ravn/dagger2-named-string-inject-example/blob/master/src/main/java/demo/Main.java" rel="noreferrer">the whole source is in a single file</a>!</p>
  
  <hr>
  
  <p>I am looking at whether dagger can replace guice for us (as our deployment Java platform is slow).</p>
  
  <p>I construct a map of configuration strings at runtime, which I would like to have dagger inject as needed.</p>
  
  <p>E.g.  If I have</p>
  
  <pre><code>java.util.Map&lt;String, String&gt; map = new java.util.TreeMap&lt;String, String&gt;();
  map.put("key", "value");
  </code></pre>
  
  <p>and </p>
  
  <pre><code>@Inject
  Thermosiphon(Heater heater, @Named("key") String value) {
      this.heater = heater;
      System.out.println("value =" + value);
  }
  </code></pre>
  
  <p>I would like to have "value" injected in value.</p>
  
  <p>The examples in the source code does not have any @Named usages.  Just trying gives the following exception:</p>
  
  <pre><code>Exception in thread "main" java.lang.IllegalStateException: Errors creating object graph:
    No binding for @javax.inject.Named(value=key)/java.lang.String required by class bar.Thermosiphon
      at dagger.internal.ThrowingErrorHandler.handleErrors(ThrowingErrorHandler.java:34)
      at dagger.internal.Linker.linkRequested(Linker.java:146)
      at dagger.ObjectGraph$DaggerObjectGraph.getInjectableTypeBinding(ObjectGraph.java:288)
      at dagger.ObjectGraph$DaggerObjectGraph.get(ObjectGraph.java:249)
      at app.CoffeeApp.main(CoffeeApp.java:20)
  </code></pre>
  
  <p>How should I approach this?</p>