My project has following setup
@Module
abstract class CoreModule {
@Provides
@Named("text1")
fun textOne() = "text1"
@Provides
@Named("text2")
fun textTwo() = "text2"
}
@Component(modules=[CoreModule::class])
interface CoreComponent{
@Named("text1")
fun textOne(): String
}
@Component(
dependencies = [CoreComponent::class]
modules=[AppModule::class]
)
interface AppComponent()
@Module()
class AppModule {
fun getStringDouble(@Named("text1") text1: String) = text1 + text1
}
Here I have 2 components CoreComponent which provides dependencies to AppComponent. Now I want to provide only text1 to AppComponent.
Since I have added @Named("text1") in CoreComponent to denote which string to provide to AppComponent. It forces me to use @Named("text1") in AppModule as well, which I don't want.
How can I create provision method in CoreComponent to provide only text1 to AppComponent in such a way, that I don't have to use @Named everywhere in AppComponent