Sebastian Schuberth
10/23/2022, 9:59 PMServiceLoader
to discover plugins on the classpath. After reading through https://itnext.io/serviceloader-the-built-in-di-framework-youve-probably-never-heard-of-1fa68a911f9b it occurred to me that ServiceLoader
can also be thought of a DI framework. So if ServiceLoader
is a DI framework, I was asking myself if Koin could also be used as a plugin framework? Is there a way to discover (unknown) components that implement an interface on the classpath with Koin, and make them available to the application?Shabinder Singh
10/24/2022, 3:50 PMarnaud.giuliani
10/24/2022, 6:14 PMPlugin
arnaud.giuliani
10/24/2022, 6:15 PMkoin.getAll<Plugin>()
for exampleSebastian Schuberth
10/24/2022, 8:45 PMmodule
? That's not the case for plugins which could be provided by adding JARs to the classpath at runtime.arnaud.giuliani
10/25/2022, 12:55 PMSebastian Schuberth
10/26/2022, 12:06 PMmodule
, I still need the `ServiceLoader`mechanism to discover those classes, right? I.e. there is no way to get rid of the ServiceLoader
mechanism by using Koin alone, but I need to use both, ServiceLoader
and Koin, correct?arnaud.giuliani
10/26/2022, 12:43 PMarnaud.giuliani
10/26/2022, 12:43 PMSebastian Schuberth
10/26/2022, 1:22 PMSebastian Schuberth
10/27/2022, 9:23 PMmodule {
singleOf(::CsvExporter) bind Exporter::class
singleOf(::ExcelExporter) bind Exporter::class
}
how would I know what to use as a parameter for singleOf()
if the class / constructor name is not known at compile time, as the JAR with the exporter might only be added at runtime?arnaud.giuliani
10/28/2022, 4:44 PMarnaud.giuliani
10/28/2022, 4:44 PMSebastian Schuberth
10/30/2022, 8:49 AMSebastian Schuberth
10/30/2022, 4:41 PMarnaud.giuliani
11/02/2022, 8:01 AMarnaud.giuliani
11/02/2022, 8:01 AMgetAll()
functionsSebastian Schuberth
11/02/2022, 9:18 AMgetAll()
be able to discover it? I'm sorry, I really need a full example analog to the ServiceLoader
- based changes in https://github.com/sschuberth/stan/commit/190542c1aa1683d6694d2348a5f0ad860013c83cShabinder Singh
11/02/2022, 9:29 AM