Hi, I have a problem with `DependencyLoopException...
# kodein
t
Hi, I have a problem with
DependencyLoopException
We have a loop in dependencies which I think is alright in our case. We use construction injection (no DiAware interface). I was hoping that using a provider can solve it, but it seems not. Any ideas?
Copy code
bind<EventBus>
    ╔╩>bind<Set<out EventHandler<in Event>>>
    ║  ╚>bind<NotificationService>
    ║    ╚>bind<EventBus>
    ╚══════╝
Copy code
class LocalEventdBus: EventBus (
    handlerProvider: () -> Set<EventHandler<Event>>,
) {...}
Copy code
bindSingleton<EventBus> { LocalEventBus(provider()) }
r
Let me rephrase your use case. You have a Super EventBus that can take handle multiple EventBus under the hood, maybe in order to broadcast the right event to the right handler ? So practically speaking, you need a least 2 different instances of EventBus. Assuming that LocalEventBus is your “Super” EventBus, how did you defined your provider ? Not important here, but you should use the instance function
bindSingleton<EventBus> { LocalEventBus(instance()) }