It,s complicated, but it doesn,t have to be: a Dagger journey
summary
Shows how to get Dagger’s compile‑time safety and top performance while cutting boilerplate by using constructor injection everywhere possible, preferring a component factory over modules or builders, and using assisted inject for runtime parameters. Demonstrates concrete tools: static @Provides, incremental annotation processing, a reflection dev fallback, and tiny extension functions that wire Dagger into Android ViewModel providers to get ViewModel‑scoped DI without subcomponents. Gives working patterns and tradeoffs so setup and build time actually improve.
AI-written summary · about
chapters (10)
- 0:00Start
- 5:48Modularization
- 7:18Constructor injection FTW Go with construction injection for all classes you own
- 8:22@Singleton is expensive
- 12:59Avoid member injection Favor exposing dependencies in the components
- 15:36External classes
- 16:42Always go for static @Provide methods No one wants your module instance
- 20:41Use the new @Component.Factory And avoid the lame module with constructor arguments or the old component Builder
- 33:18Control scope with ViewModels Take advantage of what Android gives you for free
- 37:11Take advantage of Assistedinject Assisted injection is a thing in Dagger
related talks
40mDagger-android, under the hood
15mDagger Party Tricks
49mDependency injection from zero to hero with Koin
35mDagger Reflect - The circle from runtime to compile time and back to runtime
29mDIY Dependency Injection with Kotlin
30mDagger at Scale: How Not to Stab Yourself with Your Pipelines
17mKoin vs Dagger (Service Locator vs D.I.)
42mCI/CD Reimagined: Building Portable, Composable Pipelines with Dagger
