title: Using Guice: No implementation bounded
body: <p>I am new to Guice. I using Guice in conjunction with AWS SWF. My current structure in as below:</p>
  
  <p>MainClass:</p>
  
  <pre><code> class MainClass {
  
     public static void main(String[] args) {
        Injector injector = Guice.createInjector(new ClientModule(param1, param2));
      injector = injector.createChildInjector(injector.getInstance(TestModule.class));
     }
   }
  </code></pre>
  
  <p>TestModule:    </p>
  
  <pre><code> class TestModule extends AbstractModule {
  
    @override
    protected void configure() {
    // create SWF service object
    // Register Workflow worker and Activity worker
  
     TempWorkflowClientExternalFactory fac = TempClientExternalFactoryImpl(swf_service, domain);
       bind(TempWorkflowClientExternalFactory.class).annotatedWith(Names.named("ABC")).toInstance(fac);  
    }
  }
  </code></pre>
  
  <p>Definition to class where I want to use it:</p>
  
  <pre><code> class Test {
  
    @Inject
    @Named("ABC")
    TempWorkflowClientExternalFactoryImpl fac;
  
  
     public void method() {
  
      TempWorkflowClientExternal temp = fac.getClient("123");
      temp.callWorkflowMethod()       // This method is defined in SWF Workflow Activity class 
     }
  }
  </code></pre>
  
  <p>However on execution I get the below error:</p>
  
  <p><code>No implementation for &lt;packageName&gt;.TempWorkflowClientExternalFactoryImpl annotated with @com.google.inject.name.Named(value=ABC) was bound</code></p>
  
  <p>I need the same object to be returned wherever TempWorkflowClientExternalFactory is injected.
  I tried looking up at Guice wiki/FAQ. Unfortunately I think I overlooking something or have misunderstood some concept.</p>
  
  <p>If instead of binding, I use the below code in <code>configure</code> method after creating the <code>fac</code> object, my application works as expected.</p>
  
  <pre><code> TempWorkflowClientExternal temp = fac.getClient("123");
   temp.callWorkflowMethod() 
  </code></pre>
  
  <p>However when I try to bind, it fails.</p>
  
  <p>Update: 
  If I perform the binding without the <code>annotatedWith</code>, the program executes but I can observe that binding is not done correctly as the <code>fac</code> object in <code>Test</code> class gets instantiated with default constructor and not the object I want to associate with</p>
  
  <p>Additional Detail: TempWorkflowClientExternalFactoryImpl, TempWorkflowClientExternalFactory, TempWorkflowClientExternal are also autogenerated classes by AWS-SWF. I cannot modify their constructors or add any annotations in those classes. 
  Test.method() will be invoked by when certain business logic criteria is met.</p>
  
  <p>Can someone please assist how to resolve the error?</p>