메서드 주입

    [Dagger2] 4. Component Injection 메서드 - 멤버 인젝션(Member Injection)

    멤버 인젝션(Member Injection) 메서드 앞서 다룬 프로비전(Provision) 메서드에서는 Provider에 의해 제공되는 인스턴스를 반환하였다. 그와 달리 Member Injection 메서드에서는 인스턴스를 만든다음 Provider에 의해 제공되는 인스턴스를 주입시킨다. 이는 다음 두가지 방식으로 주입이 가능하다. 바로 필드 주입 방식과 메서드 주입 방식이다. 예제3과 함께 두가지 방식을 설명한다. 예제3은 다음의 코드 구조를 가진다. 예제 링크 : https://github.com/seyoungcho2/Dagger2Example @Component(modules = [PersonModule::class]) interface SchoolComponent{ fun injectStudent(..