Click here to load reader
View
55
Download
0
Embed Size (px)
dependency Injection withDagger 2BBBTech Inc. for Android
Dependency injection? IOC (Inversion of control)
Dependency injection?
Dependency injection?
Dependency injection?
No DIWith DI
Dependency injection
Problem?
Problem?
Dependency Injection Framework
Dependency Injection FrameworkSpringGuiceDagger 1PicoContainerCDIDagger 2
Dependency Injection FrameworkSpringGuiceDagger 1PicoContainerCDIDagger 2
Dagger 2 Dagger 1 13%
Android ?Context Application (DB Manager, System Services, Analytics tracker)
Android ?Context Application (DB Manager, System Services, Analytics tracker) ButterKnife Object
Dagger 2 [email protected] : @Module : @Provide : @Component : @Module @Inject
Dagger 2 APIDagger 2 (@Module) (@Provide) (@Component) (@Inject) @Provide .
Dagger 2 [email protected] : @Module : @Provide : @Component : @Module @Inject @Scope : @Qualifier :
Dagger 2 [email protected] : @Module : @Provide : @Component : @Module @Inject @Scope : @Qualifier :
Constructor Injection @Inject private final
Method Injection @Inject this
Field Injection() @Inject private final Constructor Injection (e.g. Activity)
Scope Annotations @Singleton Custom
Show me the code!!
Android Boilerplate MVP , Presenter Activity ., , Dagger .Test Boilerplate Application, Activity, Fragment .