差異處
這裏顯示兩個版本的差異處。
java:guice [2018/06/27 20:59] tony |
java:guice [2023/06/25 09:48] |
||
---|---|---|---|
行 1: | 行 1: | ||
- | {{tag>java guice}} | ||
- | ====== Guice ====== | ||
- | ===== Articles ===== | ||
- | * [[.: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]] | ||