title: Guice FactoryModuleBuilder an instance with constructor parameters
body: <p>I´m using Guice to initalize a class with some arguments from a config file</p>
  
  <pre><code>@Provides
  @Singleton
  RetryServiceCaller provideMaxRetryAttempts(@Named("config") JsonObject config) throws IOException {
      JsonObject retryDetails = config.getJsonObject("retry_details");
      return new RetryServiceCaller(retryDetails.getInteger("maxRetryAttempts"), retryDetails.getInteger("upperBoundary"), retryDetails.getInteger("lowerBoundary"),
                                    retryDetails.getLong("multiplicationFactor"), retryDetails.getInteger("timeout"), retryDetails.getInteger("increaseTimeout"));
  }
  </code></pre>
  
  <p>This class is injected in another class which is singleton as well.</p>
  
  <pre><code>class A{
     @Inject private RetryServiceCaller retryServiceCaller;
  }
  </code></pre>
  
  <p>But now the problem is that since this new class A is singleton, I need to clone the retryServiceCaller every time that somebody use this class A.</p>
  
  <p>I´ve been investigating FactoryModuleBuilder to use it and create a factory for this class. But since the class has parameters from the config file I could not find the way to make it works.</p>
  
  <p>Something like this</p>
  
  <pre><code>  class A{
         @Inject private RetryServiceCaller.Factory retryServiceCallerFactory;
  
     }
  </code></pre>
  
  <p>Then in my RetryServiceCaller implement this</p>
  
  <pre><code>public interface Factory {
      @Inject
      RetryServiceCaller create();
  }
  
  
  @Inject
  public RetryServiceCaller(int maxRetryAttempts, int upperBoundary, int lowerBoundary, long multiplicationFactor, int timeout, int incrementTimeout) {
      this.maxRetryAttempts = maxRetryAttempts;
      this.upperBoundary = upperBoundary;
      this.lowerBoundary = lowerBoundary;
      this.multiplicationFactor = multiplicationFactor;
      this.timeout = timeout;
      this.incrementTimeout = incrementTimeout;
  }
  </code></pre>
  
  <p>But guice throw me errors saying</p>
  
  <pre><code>No implementation for com.proxy.handlers.RetryServiceCaller$Factory was bound
  </code></pre>