dimsuz
07/22/2017, 9:31 AM// binding for "internal" use, shouldn't be invoked by app code
bind<UserProfile>(tag = "internal") with scopedSingleton(mySessionScope) { session -> UserProfile(session.userId) }
bind<UserProfile>() with provider {
val profileProvider: (Session) -> UserProfile = instance() // will make use of the above binding
profileProvider.invoke(instance<Session>()) // will make use of Session's binding in current Kodein, to finally return UserProfile
}
I wrote it just before leaving home from work, but didn't check if it actually works 🙂
So I don't know if this is a good thing to do and maybe something even simpler exists in Kodein (I'm still learning this library)