koin named

    [Koin] 4. get()을 이용하여 생성자에 주입하기

    생성자 주입이 달라야 하는 이유 제공된 객체가 다른 객체의 생성자에 주입되어야 한다고 해보자. class Student(val name: String) class Teacher(val name: String, val teachingStudent: Student) 이럴 경우 Teacher은 Student를 주입받아야 한다. 이때 우리는 다음과 같이 get()을 이용해 제공된 객체를 주입받을 수 있다. single { Student("student-kim") } single { Teacher("teacher-cho", get()) } get()의 역할 예제 링크 : https://github.com/seyoungcho2/KoinExample 예제 브랜치명 : example/example3 *브랜치 필수 확인..