direct requests for dependencies Dependencies are injected by the framework With SL, our code asks the locator for specific dependencies Every class that needs an injection has a dependency on the service locator
AP and codegen to build a dependency graph “If it compiles, it will work…’’’ Requires lots of boilerplate Adds up to the build time Generates lots of code. It may be an overkill for small projects
Service Locator No proxy, codegen, introspection, annotation processing Leverage Kotlin features: delegates, reified generics, inline functions Simple declarative DSL with idiomatic Kotlin API Will crush at runtime if it can’t resolve a dependency