박상혁
04/10/2026, 6:58 AM@Configuration("app")
@Module
class RecordFlowUseCaseDiModule {
@Factory
fun provideObserveEditableRecordUseCase(
@Provided gameRecordRepository: GameRecordRepository,
): ObserveEditableRecordUseCase =
ObserveEditableRecordUseCase(gameRecordRepository)
@Factory
fun provideSaveGameRecordUseCase(
@Provided gameRecordRepository: GameRecordRepository,
): SaveGameRecordUseCase =
SaveGameRecordUseCase(gameRecordRepository)
}
@Configuration("app")
@Module
@ComponentScan("co.tami.basketball.record.feature.record")
class RecordFeatureModule
@Configuration("app")
@Module
@ComponentScan("co.tami.basketball.record.data.record")
class RecordDataModule
@Module(
includes = [
CoroutineModule::class,
RecordDataModule::class,
RecordFlowUseCaseDiModule::class,
RecordFeatureModule::class,
],
)
class AppModule
What I observed is:
1. If I remove @Provided from GameRecordRepository in domain:usecase-di, the compiler fails at A2 because domain:usecase-di cannot see the repository binding.
2. If I remove the Gradle dependency from feature:record to domain:usecase-di, the feature module cannot resolve the use case bindings during compile-time validation.
3. If RecordFeatureModule includes RecordFlowUseCaseDiModule, it works, but that feels wrong to me because it makes the feature module look like it owns the use case DI module.
So my question is:
Is using @Provided in this case the correct/recommended way to deal with cross-module visibility in A2 compile-time validation?
Or is there a better pattern to keep:
• domain:usecase plain
• domain:usecase-di as the DI owner
• app as the composition root
• feature modules from owning the use case DI module
Would the recommended solution be something like:
• keeping @Provided as-is,
• switching to typed startup / A3 full-graph validation,
• reorganizing modules differently,
• or some other Koin pattern?
Any guidance would be really appreciated