Rafal
04/26/2023, 9:14 AMconst val FORBIDDEN_INTERCEPTOR = "forbiddenInterceptor"
const val USER_AGENT_INTERCEPTOR = "userAgentInterceptor"
single<Interceptor>(named(USER_AGENT_INTERCEPTOR)) {
get<Interceptor>(named(FORBIDDEN_INTERCEPTOR)) // simulate the need to get the dep
UserAgentInterceptor()
}
singleOf(::UnauthorizedInterceptor) {
named(FORBIDDEN_INTERCEPTOR)
bind<Interceptor>()
}
both interceptors are declared in the same module but it ends up with
NoBeanDefFoundException: No definition found for class:'okhttp3.Interceptor' q:' & qualifier:'forbiddenInterceptor''. Check your definitions!
Rafal
04/26/2023, 9:15 AMUnauthorizedInterceptor
to single<Interceptor>(named(FORBIDDEN_INTERCEPTOR))
it statrts to workarnaud.giuliani
05/09/2023, 3:02 PMnamed
extension in lambda block of singleOf
. It's comes from OptionDSL here