2024/06/25 3

[Android] Dagger2 - Application 활용하기

#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위 게시글의 완성된 앱을 일부 수정해서, Application을 활용하게 만든다. 이를 통해, @Component 클래스 인스턴스의 중복 호출을 제거한다. #2 Application의 활용성 Application  |  Androi..

[Android] Dagger2 - Activity에 Dependency 주입

#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위 게시글의 완성된 앱을 일부 수정해서, 'Activity에 의존성을 주입'해본다. 이 말의 의미는 #3-1에 나온다.  #2 @Component 인터페이스 속 getter의 불편함// package com.example.activ..

[Android] Dagger2 - 인터페이스 구현체 주입 (@Binds)

#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위 게시글의 완성된 앱을 일부 수정해서, Interface를 Dependency로 주입해본다. #2 코드 수정 - 직관적인 버전#2-1 개요 [Android] Dagger2 - 매개변수#1 이전 글 [Android] Dagger2 ..