差異處
這裏顯示兩個版本的差異處。
Both sides previous revision 前次修改 下次修改 | 前次修改 | ||
java:guice [2013/11/08 18:16] tony |
java:guice [2023/06/25 09:48] (目前版本) |
||
---|---|---|---|
行 3: | 行 3: | ||
===== Articles ===== | ===== Articles ===== | ||
* [[.:guice:helloWorld|Hello World]] | * [[.:guice:helloWorld|Hello World]] | ||
+ | * [[.:guice:AOP|AOP]] | ||
==== Notes ===== | ==== Notes ===== | ||
- | * @ImplementedBy 等效於Module中做Bind to的動作。 | + | * @ImplementedBy 等效於Module中做Bind to的動作。如果有多個implementation,宣告的就是預設值。 |
* @Provider 等效於Module中設定Provider的動作。 | * @Provider 等效於Module中設定Provider的動作。 | ||
- | * 用Provider的目的是為了針對同一種interface可能會有不同type的instance,如果將不同type判斷寫在Module邏輯中是不好的。 | + | * 用Provider的目的是為了針對同一種interface可能會有不同type的instance,如果將不同type判斷寫在Module邏輯中是不好的。可以把它當simple factory用。 |
+ | * 一個APP只會有一個類別會與Injector溝通,APP不會直接與Injector溝通,而是透過此類別與Injector溝通。(把Guice當Service Locator) | ||
+ | |||
+ | ===== Resource ===== | ||
+ | ==== Refactoring ==== | ||
+ | * [[https://www.squeed.com/2016/04/11/refactoring-legacy-a-google-guice-story/|Refactoring Legacy – A Google Guice Story]] |