Using assisted injection create a complex dependency tree <p>I have recently learned about the <em>AssistedInject</em> extension to Guice and I thought it would be a nice solution to some design issues that I have. Unfortunately it seems that this solution is limited to just a one level assisted injection. Here comes an illustration of my problem - let's say we have three classes:</p> <pre><code>public class AImpl implements A{ @AssistedInject public AImpl(@Assisted Integer number, B b){ } } public class BImpl implements B { } public class CImpl implements C { @AssistedInject public CImpl(A a){ } } </code></pre> <p>a factory interface:</p> <pre><code>public interface CFactory { C create(Integer number); } </code></pre> <p>and a module:</p> <pre><code>public class ABCModule extends AbstractModule { @Override protected void configure() { bind(A.class).to(AImpl.class); bind(B.class).to(BImpl.class); install(new FactoryModuleBuilder().implement(C.class, CImpl.class).build(CFactory.class)); } public static void main(String[] args) { Guice.createInjector(new ABCModule()).getInstance(CFactory.class).create(123); } } </code></pre> <p>Above fails with following stacktrace:</p> <blockquote> <p>Exception in thread "main" com.google.inject.CreationException: Guice creation errors:</p> <p>1) Could not find a suitable constructor in stack.AImpl. Classes must have either one (and only one) constructor annotated with @Inject or a zero-argument constructor that is not private. at stack.AImpl.class(AImpl.java:12) at stack.ABCModule.configure(ABCModule.java:14)</p> <p>2) stack.CImpl has @AssistedInject constructors, but none of them match the parameters in method stack.CFactory.create(). Unable to create AssistedInject factory. while locating stack.CImpl while locating stack.C at stack.CFactory.create(CFactory.java:1)</p> <p>2 errors at com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:435) at com.google.inject.internal.InternalInjectorCreator.initializeStatically(InternalInjectorCreator.java:154) at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:106) at com.google.inject.Guice.createInjector(Guice.java:95) at com.google.inject.Guice.createInjector(Guice.java:72) at com.google.inject.Guice.createInjector(Guice.java:62) at stack.ABCModule.main(ABCModule.java:21)</p> </blockquote> <p>This obviously means that I want too much from the extension - I hoped that the injector will search deep down in the dependecy tree searching for the @Assisted dependency. Is there any way to do this kind of assisted injection or do I need to implement my factory by myself?</p>