假设我有这样的代码(一般),假设我需要在类C中使用ILogger,而在类A和B中不需要它 public class A var classB = new B();public classC();public class C //Here I want to use the Ilogger service
} 但是沿着整个链传递构造函数似乎是不合理的,并且随着使用的服务的增加那么,如何正确地调用C类中的服务<
我有一个带有Hilt依赖注入的Android项目。我将MyApplication和MyModule定义如下。constructor(
override fun doSomething() = ""现在我可以将MyRepository的这个实现插入到一个ViewModel中:但是,如果我试图将存储库注入服务,则会得到一个错误java.lang.Class<MyService> has no zero argument co