2007-03-18から1日間の記事一覧
注釈によるバインディングIf you need multiple bindings to the same type, you can differentiate the bindings with annotations. For example, to bind an interface Service and annotation @Blue to the concrete implementation BlueService, call:複…
DRY (自分で書いたものを繰り返すな!)Repeating "binder" over and over for each binding can get a little tedious. Guice provides a Module support class named AbstractModule which implicitly gives you access to Binder's methods. For example…
依存性のバインディングHow does Guice know what to inject? For starters, a Key composed of a type and an optional annotation uniquely identifies a dependency. Guice refers to the mapping between a key and an implementation as a Binding. An …
独力で動くアプリケーションThe idea of bootstrapping is fundamental to dependency injection. Always explicitly asking the Injector for dependencies would be using Guice as a service locator, not a dependency injection framework.「独力で動く…
属性つきのアノテーションIf you can get by with marker annotations alone, feel free to skip to the next section.もし、あなたがマーカーアノテーションだけでやっていくことができるなら、遠慮なく次のセクションまでスキップしてください。You can al…
バインディング用のアノテーションを作るWhere did this @Blue annotation just mentioned come from? You can create such an annotation easily, although the standard incantation you have to use is unfortunately a little complex:先ほど話題に出た…