You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
when I try to add two bindings in a subscope which depends on each other the injection does not work. (it works if I add them to the rootScope)
What did I miss?
Thanks
KTP.openRootScope()
.openSubScope(SUB_SCOPE) //if remove this line it is working
.installModules(
module {
bind<Foo>().toProvider(FooProvider::class)
bind<Bar>().toProvider(BarProvider::class)
}
)
.inject(this)
interface Foo {
val text: String
}
@Singleton
@ProvidesSingletonInScope
//@InjectConstructor //didn't help
class FooProvider: Provider<Foo> {
override fun get() = object : Foo {
override val text: String = "Foo"
}
}
interface Bar {
val fooInstance: Foo
}
@Singleton
@ProvidesSingletonInScope
@InjectConstructor
class BarProvider(
val injectedFoo: Foo
): Provider<Bar> {
override fun get() = object : Bar {
override val fooInstance: Foo = injectedFoo
}
}
RuntimeException:
toothpick.locators.NoFactoryFoundException: No factory could be found for class com.example.Foo. Check that the class has either a @Inject annotated constructor or contains @Inject annotated members.
Caused by: java.lang.ClassNotFoundException: com.example.Foo__Factory
The text was updated successfully, but these errors were encountered:
Hi,
when I try to add two bindings in a subscope which depends on each other the injection does not work. (it works if I add them to the rootScope)
What did I miss?
Thanks
RuntimeException:
toothpick.locators.NoFactoryFoundException: No factory could be found for class com.example.Foo. Check that the class has either a @Inject annotated constructor or contains @Inject annotated members.
Caused by: java.lang.ClassNotFoundException: com.example.Foo__Factory
The text was updated successfully, but these errors were encountered: