Closed lukelast closed 6 days ago
Is it ever necessary to reference the module outside of instantiating Koin/multiple times? If so, couldn't this proposal cause problems? I'm not certain that referencing a module multiple times is ever needed, so this may not actually cause any problems.
I see 2 options for implementing a fix.
ScanModule.module
to return a new instance of the module each time.ScanModule.createModule()
Either would work for me. With option 1 you can still create and use a global module that would be shared across multiple koin instances, you would just have to do it explicitly.
Ok interesting 🤔 need to check the global impact of this
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
You're breaking my heart stale bot.
duplicated with #102
Is your feature request related to a problem? Please describe. I'm trying to create many instances of
KoinApplication
to use in tests that run in parallel. Currently this not possible because the generated module instances are set in global variables.For example, code like this:
Will generate code like this:
The
foo_ScanModule
keeps a single global instance of the module, which causes singletons to be shared among all koin instances created with this module.Describe the solution you'd like I think calling
ScanModule.module
should create a new instance of the module each time.