https://kotlinlang.org logo
#kotlin-inject
Title
# kotlin-inject
l

leandro

03/14/2023, 2:33 PM
Is it possible to reuse my Singleton annotation across nested components? I am not sure I understand the problems of allowing the same scope on a child and parent component.
l

leandro

03/15/2023, 9:24 AM
I think I understand... what do you recommend on this case? Suppose I have a dbComponent providing a Singleton-annotated instance of my database. How can I use this component to create an ApplicationComponent which will also use the database as a single instance?
p

Paul Woitaschek

03/18/2023, 7:23 PM
Just add the db component inside the app component?
(so just annotate the db with @DbScope)
l

leandro

03/19/2023, 12:44 PM
Yeah that’s fine. I failed to convey that it was a sample issue, what would be the strategy if one has several components and they all have an intricate dependency of each other. That’s probably several singleton annotations with different names
29 Views