Helio
05/10/2021, 7:11 AMorg.koin.core.error.NoBeanDefFoundException: No definition found for class:'com.atlassian.buildeng.pipeline.compliant.checker.service.BuildInfoService'. Check your definitions!
The class that it is complaining about, it is actually an interface
interface BuildInfoService<T : HttpRequestParamsModel, out P> {
suspend fun getBuildInfo(httpRequestParamsModel: T): P
}
I’m currently trying to configure my Koin test module with classes that implement that interface. In my definition, I’m adding qualifier to everything. Example:
val testModule = module {
...
single<BuildInfoService<ModelA, TypeA>>(named("BuildInfoService_A")) { MyClassA(get(named("ServiceA"))) }
single<BuildInfoService<ModelB, TypeB>>(named("BuildInfoService_B")) { MyClassB(get(named("ServiceB")), get(named("ServiceA"))) }
...
}
Just to complement a bit further, the project is running Koin = 2.2.2
and Ktor=1.5.1
.
Any help would be greatly appreciated.tynn
05/10/2021, 7:15 AMget<BuildInfoService>()
somewhere.Helio
05/10/2021, 7:19 AMtynn
05/10/2021, 7:22 AMBuildInfoService
might be inferred. You’re code might only contain get()
as argument for a BuildInfoService
parameterHelio
05/10/2021, 7:36 AMBuildInfoService
being inferred. But the classes that implement it, accept arguments, which I’m injecting. Example:
class MyClassA(private val serviceA: ServiceA) : BuildInfoService<ModelA, TypeA>
class MyClassB(private val serviceB: ServiceB, val serviceA: ServiceA) : BuildInfoService<ModelB, TypeB>
tynn
05/10/2021, 7:38 AMBuildInfoService
into other classes?Helio
05/10/2021, 7:40 AMBuildInfoservice<A,B>
like this:
single { GetBuildA(get(named("BuildInfoService_A"))) }
single { GetBuildB(get(named("BuildInfoService_B"))) }
Helio
05/10/2021, 7:41 AMHelio
05/10/2021, 7:44 AMtestModule
tynn
05/10/2021, 7:45 AMHelio
05/10/2021, 7:46 AMBitbucketBuildServiceImplTest > testShouldNotGetStepStateIfStepIdIsNotProvided() FAILED
org.koin.core.error.NoBeanDefFoundException: No definition found for class:'com.atlassian.buildeng.pipeline.compliant.checker.service.BuildInfoService'. Check your definitions!
at org.koin.core.scope.Scope.throwDefinitionNotFound(Scope.kt:282)
at org.koin.core.scope.Scope.resolveInstance(Scope.kt:251)
at org.koin.core.scope.Scope.get(Scope.kt:204)
at service.BitbucketBuildServiceImplTest$$special$$inlined$inject$1.invoke(KoinTest.kt:54)
at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
at service.BitbucketBuildServiceImplTest.getBuildInfoService(BitbucketBuildServiceImplTest.kt)
at service.BitbucketBuildServiceImplTest.access$getBuildInfoService$p(BitbucketBuildServiceImplTest.kt:36)
at service.BitbucketBuildServiceImplTest$testShouldNotGetStepStateIfStepIdIsNotProvided$1.invokeSuspend(BitbucketBuildServiceImplTest.kt:73)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:274)
at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:84)
at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:59)
at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source)
at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:38)
at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source)
at service.BitbucketBuildServiceImplTest.testShouldNotGetStepStateIfStepIdIsNotProvided(BitbucketBuildServiceImplTest.kt:73)
tynn
05/10/2021, 7:48 AMHelio
05/10/2021, 7:48 AMtynn
05/10/2021, 7:50 AMtestModule
to your dependency graph?Helio
05/10/2021, 7:51 AMHelio
05/10/2021, 7:55 AMtynn
05/10/2021, 7:55 AMinject(named('...'))
for your test build info service as well.Helio
05/10/2021, 7:56 AMtynn
05/10/2021, 7:57 AMtynn
05/10/2021, 7:57 AMHelio
05/10/2021, 7:57 AMtynn
05/10/2021, 7:58 AMtynn
05/10/2021, 7:58 AMHelio
05/10/2021, 8:02 AMHelio
05/10/2021, 8:06 AMtynn
05/10/2021, 8:07 AMHelio
05/10/2021, 8:08 AMHelio
05/10/2021, 8:08 AMtynn
05/10/2021, 8:09 AM