差異處

這裏顯示兩個版本的差異處。

連向這個比對檢視

下次修改
前次修改
java:guice [2013/11/08 17:02]
tony 建立
java:guice [2023/06/25 09:48] (目前版本)
行 3: 行 3:
 ===== Articles ===== ===== Articles =====
   * [[.:​guice:​helloWorld|Hello World]]   * [[.:​guice:​helloWorld|Hello World]]
 +  * [[.:​guice:​AOP|AOP]]
 +==== Notes =====
 +  * @ImplementedBy 等效於Module中做Bind to的動作。如果有多個implementation,宣告的就是預設值。
 +  * @Provider 等效於Module中設定Provider的動作。
 +  * 用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]]