Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
dagger_2 [2018/12/24 15:06] – 만듦 ledyxdagger_2 [2021/02/07 05:50] (current) – old revision restored (2018/12/24 15:10) ledyx
Line 12: Line 12:
 Dagger 공식 홈에 있는 CoffeeMaker 예제 단순화. Dagger 공식 홈에 있는 CoffeeMaker 예제 단순화.
  
 += pom.xml =
 +<sxh xml ; collapse:true>
 +...
 +
 +    <dependencies>
 +        <dependency>
 +            <groupId>com.google.dagger</groupId>
 +            <artifactId>dagger</artifactId>
 +            <version>${dagger.version}</version>
 +        </dependency>
 +    </dependencies>
 +
 +    <build>
 +        <plugins>
 +            <plugin>
 +                <groupId>org.apache.maven.plugins</groupId>
 +                <artifactId>maven-compiler-plugin</artifactId>
 +                <version>3.6.1</version>
 +                <configuration>
 +                    <annotationProcessorPaths>
 +                        <path>
 +                            <groupId>com.google.dagger</groupId>
 +                            <artifactId>dagger-compiler</artifactId>
 +                            <version>${dagger.version}</version>
 +                        </path>
 +                    </annotationProcessorPaths>
 +                </configuration>
 +            </plugin>
 +        </plugins>
 +    </build>
 + 
 +...
 +</sxh>
  
 = 주입 할 대상 = = 주입 할 대상 =
Line 130: Line 163:
 </sxh> </sxh>
  
 +
 += Context =
 +
 +먼저 Build를 하여 DI가 적용된 코드가 생성되도록 한다.
 +
 +<sxh>
 +public class CoffeeApp {
 +    public static void main(String... args) {
 +        CoffeeComponent coffeeComponent = DaggerCoffeeComponent.create();
 +        coffeeComponent.maker().brew();
 +    }
 +}
 +</sxh>
 +
 +<code>
 +~ ~ ~ heating ~ ~ ~
 +=> => pumping => =>
 +brew!
 +</code>
dagger_2.1545663977.txt.gz · Last modified: (external edit)