Provided Named Dependencies
See original GitHub issueHow to use the provides method to replace named dependencies inside the dependency graph ?
e.g
provides(
@Named("Auth") OkHttpClient::class.java, // throws compile time error
MockHttpClient.getClient())
Is there any other way to do this ?
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Named injected dependencies in .NET 5 / Core - Realfiction
In some research I came across Steve Collins' blog post on "Getting named dependencies by Name or Key using the .NET Core Container"....
Read more >Getting Dependencies by Name or Key using the .NET Core ...
In this post, I demonstrate how to use custom typed delegates to perform named/keyed dependency injection using the Microsoft Dependency ...
Read more >c# - Dependency injection resolving by name - Stack Overflow
I found the quickest object instantiation occurred when I merely ran a simple LINQ query against the IEnumerable that's created by default in...
Read more >Dependency injection in ASP.NET Core | Microsoft Learn
Services and their dependencies within an ASP.NET Core request are exposed through HttpContext.RequestServices. The framework creates a scope ...
Read more >Dependency Injection using @Inject and @Named Annotations
The Dependency is Mandatory when using @Inject. If it is not available,it will throw an exception at run-time. You can use @Nullable annotation ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Released right now: https://jitpack.io/#fabioCollini/DaggerMock/0.8.5
Hi @krazykira, I have implemented this feature in the last commit 383fa8003e, can you try it using this commit as DaggerMock version?
In your example the syntax to use should be this:
Let me know if it works!