Seasar4 EA1

Seasar4 EA1にさわりました。新感覚な世界です。これで設定ファイル書かなければいけないからDIコンテナ嫌いという人が興味もってくれるといいなぁ。以下さわってみて気づいたことのメモ。

  • S2ContainerのgetComponentメソッドを呼び出す前にS2Containerのinitメソッドが呼ばれていなければいけない。(initメソッド呼ばなくてもAutoRegisterのコンポーネントが1度動けば良いと思う)
  • autoRegister.diconでFileSystemComponentAutoRegisterにClassPatternを指定する際に、インタフェースかその実装クラスのどちらかしか含まれないように注意する。インタフェースを含める場合はInterceptorが動くようにしておく(とりあえずInterceptorAutoRegisterを使う。今後アノテーションでInterceptorを指定できるようになる?)。
  • ClassPatternの指定の際InterceptorAutoRegisterとFileSystemComponentAutoRegisterで意味が若干異なる(たぶん)。InterceptorAutoRegisterでは指定されたパッケージの以下すべてを対象とするが、FileSystemComponentAutoRegisterではそうではなく指定されたパッケージのみを対象とする。FileSystemComponentAutoRegisterに複数パッケージを指定する場合は1つずつ指定する。