CaptionsMaker
.com
Dagger 2 Tutorial Part 2 - COMPONENT, PROVISION METHODS & CONSTRUCTOR INJECTION - Android Tutorial
Edit Subtitles
Download Subtitles
SRT
TXT
Title:
Description:
In part 2 of the Dagger 2 tutorial, we will add the google/dagger dependencies to a new Android Studio project (for now we ignore the dagger.android classes) and then start learning how to use the Dagger 2 API. We create a new Java interface that we annotate with @Component and which has 1 method declaration that returns our requested fully instantiated object. Dagger will then at compile time generate the implementation for this so-called provision method so we can use it in our activity. In order for this to work, we have to tell Dagger how to create all the necessary dependencies. One way of doing this is with the help of constructor injection, for which we have to annotate all the constructors Dagger has to know about with @Inject. This javax annotation is standardized under JSR 330. Dagger will then internally generate a directed acyclic graph (DAG) that contains all the dependencies in the correct order. For this, it doesn't use any Java reflection like earlier dependency injection frameworks (like Spring, Guice or Dagger 1). Watch the whole playlist: https://www.youtube.com/playlist?list=PLrnPJCHvNZuA2ioi4soDZKz8euUQnJW65 Example code + dependencies: https://codinginflow.com/tutorials/android/dagger-2/part-2-component-provision-method-constructor-injection ____________________ ❗ Subscribe to the channel: https://www.youtube.com/c/codinginflow?sub_confirmation=1 ⏯ Watch more tutorials: https://www.youtube.com/c/codinginflow/playlists ㊙ Help translating the videos: http://www.youtube.com/timedtext_cs_panel?c=UC_Fh8kvtkVPkeihBs42jGcA&tab=2 💚 Support the content: https://codinginflow.com/support-the-content 💬 Join the Discord chat: https://discord.gg/TSnMvmc 🎧 Audiobooks and podcasts for programmers: https://codinginflow.com/audiobooks-podcasts-programmer 👶 How to get started with Android development: https://codinginflow.com/learn-android-development-complete-beginner 📣 Follow Coding in Flow on social media: Facebook: https://www.facebook.com/codinginflow Instagram: https://www.instagram.com/codinginflow Twitter: https://twitter.com/codinginflow Blog: https://codinginflow.com
YouTube url:
https://www.youtube.com/watch?v=wJkHYBf8VkA
Created:
6. 1. 2020 17:13:25