22. GrailsはSpring!
Grailsは、形を変えたSpring-MVC
Spring + Hibernateを抽象化したものである
プラグインの仕組みで
Springフレームワークの定義を自動化
Spring Beanビルダー
22 参考資料: “Grails for Spring Developers” by Graeme Rocher
23. Out of the Box
Hibernate上に構築された、簡単に利用できる
O/Rマッピングレイヤ データベース
表現豊かなビューテクノロジー View
Groovy Server Pages (GSP) MVC2
コントローラレイヤは Spring MVCを利用
コマンドラインスクリプト環境には ビルドシステム
Groovy版のAnt Gant
リロード可能に設定された組込 Tomcat
コンテナ
組込 Spring DSLによる依存注入 DI 国際化
SpringのMessageSourceで実装されたi18n対応
Springフレームワークのトランザクション実装による
23 サービスレイヤのトランザクション トランザクション
30. Grailsの仕組み ur ity
S ec
low
Controller
i1 8n
Flex
bF
We
Codec Quartz
Domain
他の
プラグイン
Grails lug
in
JMS
MyP
Core Quartz
ag gin
Service UrlMapping T
Filters
30
38. Grails1.3.1
フィルタオーダリング
dependsOnプロパティを定義することで、フィルタの実
行順番を定義できる。
class MyFilters {
def dependsOn = [MyOtherFilters]
def filters = { … }
}
GSP タグ "unless" <g:unless test="${cacheEnabled}">
Tag Body Goes Here
</g:unless>
名前つきクエリーのネスト
TagLib テスト
38
39. Grails1.3.2
Groovy 1.7.3、Spring 3.0.3 更新
スクリプトのもしかして機能
~/workspace/testapp $ grails create-doman-class
testapp.Author
Welcome to Grails 1.3.2 - http://grails.org/
Licensed under Apache Standard License 2.0
…
Script 'CreateDomanClass' not found, did you mean:
1) CreateDomainClass
2) CreateApp_
3) CreateScript
4) CreateFilters
5) CreateUnitTest
Please make a selection or enter Q to quit:
findメソッドのクエリーキャッシュサポート
Book.findAll(
"from Book as b where b.author=:author",
[author:'Dan Brown'], [cache: true])
39
40. Grails1.3.3
バグフィックス
Database Mappingに、insertable、
updateable
class Book {
String title
static belongsTo = [author: Author]
…
static mapping = {
author insertable: false
author updateable: false
}
}
40