AOPオプション
Guice 1.0ではその一つのバージョンにAOPが組み込まれていた。
Guice 2.0ではAOPをオプションとしている。 もしプラットフォームがバイトコード生成をサポートしていないのであれば、AOP無しのバージョンのGuiceをダウンロードして欲しい。 これはAndroidのようなモバイルプラットフォームで便利だろう。 このバージョンは高速リフレクション(訳注:?)とエラーメッセージの行番号も欠如している。 これらの理由からメソッドインターセプターを用いないアプリケーションにもGuice+AOP 2.0をおすすめする。
機能比較
|
Guice 1.0 |
Guice 2.0 no AOP |
Guice 2.0 |
GIN |
Library size |
544KB |
430KB |
652KB |
0KB (code gen) |
High performance |
✔ |
✔ |
✔ |
✔ |
Binding EDSL |
✔ |
✔ |
✔ |
✔ |
Scopes |
✔ |
✔ |
✔ |
✔ |
Typesafe |
✔ |
✔ |
✔ |
✔ |
Fast reflection |
✔ (cglib) |
|
✔ (cglib) |
✔ (code gen) |
||Line numbers in error messages||✔|| ||✔|| || ||Method interceptors||✔|| ||✔|| ||
Provider Methods |
|
✔ |
✔ |
✔ |
||Binding overrides|| ||✔||✔|| || ||Tool-friendly SPI|| ||✔||✔|| || ||Child Injectors|| ||✔||✔|| || ||Servlet Support|| Scopes Only ✔ ✔ ||Error Reporting|| Good Better Best Best
==Building Guice without AOP==
Guice has an ant task that creates a modified copy of the Guice source-tree. The copy uses the munge preprocessor to remove all bytecode-dependent APIs. Use the following commands to build Guice without AOP support:
ant no_aop cd build/no_aop/ ant dist