2024/06/24 3

[Android] Dagger2 - 매개변수 동적 할당

#1 이전 글 [Android] Dagger2 - @Provides#1 이전 글 [Android] Dagger2 - 기초#1 이전 글 의존성 주입 (Dependency Injection)#1 의존성 주입(Dependency Injection)이란?#1-1 Dependent와 Dependencyfun main() { val car = Car() car.startCar() } class Car { private val engine = Enginekenel.tistory.com위 게시글의 완성된 앱을 일부 수정해서, @Provides 또는 @Module이 매개변수를 가지게 만들어본다.  Dagger 라이브러리를 쓰는 프로젝트에서 @Provides 또는 @Module에 인수를 전달하기 위해서는 먼저 dagger..

[Android] Dagger2 - @Provides

#1 이전 글 [Android] Dagger2 - 기초#1 이전 글 의존성 주입 (Dependency Injection)#1 의존성 주입(Dependency Injection)이란?#1-1 Dependent와 Dependencyfun main() { val car = Car() car.startCar() } class Car { private val engine = Engine() private val airbag = Airbag() privatekenel.tistory.com위 게시글의 완성된 앱을 일부 수정해서, @Inject를 사용할 수 없는 경우의 의존성 주입을 해결해본다. #2 @Provides이전 글에선 생성자에 @Inject를 붙였고, 그것은 dagger가 의존성 주입을 하는 명시적인 표시로..

[Android] Dagger2 - 기초

#1 이전 글 의존성 주입 (Dependency Injection)#1 의존성 주입(Dependency Injection)이란?#1-1 Dependent와 Dependencyfun main() { val car = Car() car.startCar() } class Car { private val engine = Engine() private val airbag = Airbag() private val battery = Battery() fun startCar() { engine.startEkenel.tistory.com본 게시글을 이해하려면 먼저, 의존성 주입에 대해 쓴 이전 게시글을 읽어야 한다. 또, 이전 게시글의 코드를 Migration해서 본 게시글의 코드를 작성했다. #2 dagger GitH..