Java – can anyone provide a good explanation for dagger 2?

It's really hard for me to understand dagger 2 dependency injection system

I understand that using the @ inject annotation tells the dagger that we need to provide some types of instances here

However, I don't understand the various roles of other components, such as @ module, @ component, @ provides, and how they work together to provide appropriate instances for appropriate dependencies

Can anyone explain it briefly?

Solution

I suggest you read:

> Tasting Dagger 2 on Android by Fernando Cejas > Dependency Injection with Dagger 2 (Devoxx 2014) by Jake Wharton > @L_ 502_ 2@ > Dependency injection with Dagger 2 – the API by froger_ mcs > Dependency injection with Dagger 2 – Custom scopes by froger_ mcs

I think it will help to understand

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>