4 ms·
I'm keeping an eye out on Kotlin's context receiver change, as I would much prefer a way to tackle dependency injection without using annotations and definitely
by yen223 4y ago
I'm keeping an eye out on Kotlin's context receiver change, as I would much prefer a way to tackle dependency injection without using annotations and definitely without using XML. DI frameworks are already the insane man's DI.
- ohgodplsno 4y agoHave you considered something like Dagger + Anvil (https://github.com/square/anvil https://github.com/square/anvil) ? It works well enough that it gets out of your way. Is it doing insane things in the background at compilation time ? Absolutely. But it's worth it. And to save time in debug, you can shim in dagger-reflect to avoid the cost of having to run annotation processors.
- brabel 4y agoI would say the state-of-the-art today is Micronaut's DI [1]. [1] https://docs.micronaut.io/1.0.0/guide/index.html#ioc https://docs.micronaut.io/1.0.0/guide/index.html#ioc
- ohgodplsno 4y agoUh, that's a service locator with an annotation processor to discover injectable targets. It's far from being state of the art. It's like Koin, except slightly less manual. A far cry from automatically discovered injection
- brabel 4y ago> A far cry from automatically discovered injection Ok, then what's the wonderful DI system that has that? Micronaut was created by ex-Spring developers who had experience with all the earlier DI systems, including Dagger, Guice, PicoContainer etc. I would love to learn what people have come up with that's even nicer to use!
- vips7L 4y agoIMO the state of the art is Weld. With CDI lite you now can have compile time DI instead of having it resolved at runtime. https://weld.cdi-spec.org/ https://weld.cdi-spec.org/
- brabel 4y agoMicronaut DI is compile-time for almost everything.