ServiceへのDataSourceの注入

http://d.hatena.ne.jp/atosimitu/20081031/p1で,サービスへデータソースを注入している例をみつけたときは「そうゆう裏技もあるんだぁ」程度に思っていたのだけれど,あらためてgrails.org調べてたら,ちゃんと書いてあった。

A javax.sql.DataSource instance can be retrieved for the configured database by adding the property:

javax.sql.DataSource dataSource

This could be used in conjunction with Spring's JdbcTemplate to perform direct transactional SQL operations or with Groovy Sql

Grails - Services - Dependency Injection


むむぅ,これでGORMで悩んだらGSQLへ逃げる道筋が確立してしまった。
ますますもって,Grailsを使わない理由がなくなってきたゾ。:-)