我正在手动创建新类,而没有通过匕首注入,但是该类中的所有实例变量都应该通过匕首注入。
例如:
class TestingClass constructor() {
@Inject
lateinit var test: Test
fun testing() {
test.doSomeThing()
}
}
class Test @Inject constructor() {
fun doSomeThing() {
}
}
TestingClass().testing()
我正在尝试实现上述方案,但是会引发错误
kotlin.UninitializedPropertyAccessException: lateinit property test has not been initialized
是否可以实现此方案,有人可以帮助我吗?