SlideShare a Scribd company logo
Spring Rooで作るGWT
  アプリケーション
       @making
      2011/11/13
Spring Rooとは
 SpringベースのJavaアプリをコマンドラインでさくさ
  く作るためのRADツール

 http://www.springsource.org/spring-roo
   安定版は1.1.5.RELEASEが最新
   開発版は1.2.0.M1が最新
     今回の説明は1.2系で!

 コマンドを叩くとJavaソースコード、XML設定ファイ
  ル、Maven依存関係の追加などを行ってくれる。
  Scaffoldも
入門記事
 この辺でGetting Started
 http://www.ibm.com/developerworks/jp/opensource/libr
  ary/os-springroo1/index.html

 http://www.atmarkit.co.jp/fjava/index/index_springroo.ht
  ml
Rooアプリの構成


       Web層           サービス層        永続化層          データベース




  •   Spring MVC              • JPA              •   MySQL
  •   GWT                        • Hibernate     •   PostgreSQL
  •   Vaadin(addon)              • EclipseLink   •   Oracle
  •   Flex (addon)               • TopLink       •   H2
                                 • DataNucleus   •   HyperSonic
                              • JMS              •   GAE
1.2からサービス層、レポジトリ層が追                              •   MongoDB
加
1.2からのアプリ層
公式チュートリアルアプリ




http://static.springsource.org/spring-roo/reference/html/beginning.html
Spring Rooプロジェクト作成
$ mkdir pizza
$ cd pizza
$ roo.sh

# プロジェクト作成
roo> project --topLevelPackage com.example.pizza

# 永続化層(JPA)の定義
roo> jpa setup --provider HIBERNATE --database
HYPERSONIC_IN_MEMORY
エンティティ層の定義
# エンティティ作成

roo> entity --class ~.domain.Topping –testAutomatically

roo> field string --fieldName name --notNull --sizeMin 2

roo> entity --class ~.domain.Base –testAutomatically

roo> field string --fieldName name --notNull --sizeMin 2

roo> entity --class ~.domain.Pizza –testAutomatically

roo> field string --fieldName name --notNull --sizeMin 2

roo> field number --fieldName price --type java.lang.Float
一対多の定義
roo> field set --fieldName toppings --type ~.domain.Topping
一対一の定義
roo> field reference --fieldName base --type ~.domain.Base
もう一個
roo> entity --class ~.domain.PizzaOrder --testAutomatically

roo> field string --fieldName name --notNull --sizeMin 2

roo> field string --fieldName address --sizeMax 30

roo> field number --fieldName total --type java.lang.Float

roo> field date --fieldName deliveryDate --type java.util.Date

roo> field set --fieldName pizzas --type ~.domain.Pizza
ログ
project --topLevelPackage com.example.pizza
jpa setup --provider HIBERNATE --database HYPERSONIC_IN_MEMORY
entity --class ~.domain.Topping --testAutomatically
field string --fieldName name --notNull --sizeMin 2
entity --class ~.domain.Base --testAutomatically
field string --fieldName name --notNull --sizeMin 2
entity --class ~.domain.Pizza --testAutomatically
field string --fieldName name --notNull --sizeMin 2
field number --fieldName price --type java.lang.Float
field set --fieldName toppings --type ~.domain.Topping
field reference --fieldName base --type ~.domain.Base
entity --class ~.domain.PizzaOrder --testAutomatically
field string --fieldName name --notNull --sizeMin 2
field string --fieldName address --sizeMax 30
field number --fieldName total --type java.lang.Float
field date --fieldName deliveryDate --type java.util.Date
field set --fieldName pizzas --type ~.domain.Pizza
ログの読み込み
$ roo.sh script log.roo
Web層の定義
      通常(Spring MVCアプリ)は
     roo> web mvc setup

     roo> web mvc all --package ~.web


      GWTの場合
roo> web gwt setup

roo> web gwt all --proxyPackage ~.client.proxy --requestPackage ~.client.request




     ScaffoldなCRUDアプリが自動生成される
GWTアプリ起動
$ mvn gwt:run
[補足]Spring MVCの場合
$ mvn jetty:run
ここから先は
 未調査!
  どうやって画面を使いするの?
 次回に続く?
参考情報
 http://spring-roo-
  repository.springsource.org/Getting_Started_with_Roo.
  pdf

 オライリー本のPDFがダウンロードできます。
   オライリーで買うと$14.99。。どういうことだってばよ
おわり
 Spring RooでCRUDアプリを簡単にGWTでつくれまし
 た
付録
    Spring RooのGWTコマンド
web gwt all - すべてのエンティティをプロジェクトに配置して GWT リクエストとプロキシを生成し,
処理の基盤を構成する

web gwt gae update - GWT プロジェクトを更新して,GAE サポートを追加する

web gwt proxy all - すべてのエンティティをプロジェクトに配置して GWT プロキシを生成する

web gwt proxy request all - すべてのエンティティをプロジェクトに配置して GWT リクエストとプロ
キシを生成する

web gwt proxy request type - 指定された型をベースとするプロキシとリクエストを生成する

web gwt proxy type - 指定された型をベースとする GWT プロキシを生成する

web gwt request all - すべてのエンティティをプロジェクトに配置して GWT リクエストを生成する

web gwt request type - 指定された型をベースとする GWT プロキシを生成する

web gwt scaffold - GWT リクエストとプロキシ,および指定された基盤を生成する


http://www.infoq.com/jp/news/2011/10/spring-roo-1.2-m1-asl-jpa-mongo より

More Related Content

What's hot

What's hot (19)

Gaej Explorer
Gaej ExplorerGaej Explorer
Gaej Explorer
 
Webサーバ勉強会 LT資料
Webサーバ勉強会 LT資料Webサーバ勉強会 LT資料
Webサーバ勉強会 LT資料
 
serverspecを使用したサーバ設定テストの実例
serverspecを使用したサーバ設定テストの実例serverspecを使用したサーバ設定テストの実例
serverspecを使用したサーバ設定テストの実例
 
cpanfile
cpanfilecpanfile
cpanfile
 
Appsody でnodejsのアプリを立ち上げよう!
Appsody でnodejsのアプリを立ち上げよう!Appsody でnodejsのアプリを立ち上げよう!
Appsody でnodejsのアプリを立ち上げよう!
 
キメるClojure
キメるClojureキメるClojure
キメるClojure
 
Gulp入門 - コーディングを10倍速くする
Gulp入門 - コーディングを10倍速くするGulp入門 - コーディングを10倍速くする
Gulp入門 - コーディングを10倍速くする
 
Spring Boot概要
Spring Boot概要Spring Boot概要
Spring Boot概要
 
SpringOne 2GX 2014 参加報告 & Spring 4.1について #jsug
SpringOne 2GX 2014 参加報告 & Spring 4.1について #jsugSpringOne 2GX 2014 参加報告 & Spring 4.1について #jsug
SpringOne 2GX 2014 参加報告 & Spring 4.1について #jsug
 
OpenShift from Easy way to Hard ? Way
OpenShift from Easy way to Hard ? WayOpenShift from Easy way to Hard ? Way
OpenShift from Easy way to Hard ? Way
 
Vagrant+Chef
Vagrant+ChefVagrant+Chef
Vagrant+Chef
 
WebAssemblyが切り拓くフロントエンドWeb開発の未来
WebAssemblyが切り拓くフロントエンドWeb開発の未来WebAssemblyが切り拓くフロントエンドWeb開発の未来
WebAssemblyが切り拓くフロントエンドWeb開発の未来
 
gulp + Slim テンプレートエンジンで HTML を効率よく書き出そう
gulp + Slim テンプレートエンジンで HTML を効率よく書き出そうgulp + Slim テンプレートエンジンで HTML を効率よく書き出そう
gulp + Slim テンプレートエンジンで HTML を効率よく書き出そう
 
Niigata.pm #1
Niigata.pm #1Niigata.pm #1
Niigata.pm #1
 
活動報告9 laravel5入門-
活動報告9  laravel5入門-活動報告9  laravel5入門-
活動報告9 laravel5入門-
 
#7 Controller
#7 Controller#7 Controller
#7 Controller
 
AWSとAnsibleで実践!プロビジョニング入門‐Lamp+Laravel-
AWSとAnsibleで実践!プロビジョニング入門‐Lamp+Laravel-AWSとAnsibleで実践!プロビジョニング入門‐Lamp+Laravel-
AWSとAnsibleで実践!プロビジョニング入門‐Lamp+Laravel-
 
Zabbixを2分でインストール
Zabbixを2分でインストールZabbixを2分でインストール
Zabbixを2分でインストール
 
StackStormではじめる1人Slackのすすめ
StackStormではじめる1人SlackのすすめStackStormではじめる1人Slackのすすめ
StackStormではじめる1人Slackのすすめ
 

Viewers also liked

ShibuyalispTT#4 LT 他言語で作ったWEBページをLispでも!
ShibuyalispTT#4 LT 他言語で作ったWEBページをLispでも!ShibuyalispTT#4 LT 他言語で作ったWEBページをLispでも!
ShibuyalispTT#4 LT 他言語で作ったWEBページをLispでも!
Toshiaki Maki
 
Clojure+Leiningenで3分Hadoop
Clojure+Leiningenで3分HadoopClojure+Leiningenで3分Hadoop
Clojure+Leiningenで3分Hadoop
Toshiaki Maki
 
CategoLJについて
CategoLJについてCategoLJについて
CategoLJについて
Toshiaki Maki
 
Thin Server Architectureでブログ作った #ikam
Thin Server Architectureでブログ作った #ikamThin Server Architectureでブログ作った #ikam
Thin Server Architectureでブログ作った #ikam
Toshiaki Maki
 

Viewers also liked (7)

ShibuyalispTT#4 LT 他言語で作ったWEBページをLispでも!
ShibuyalispTT#4 LT 他言語で作ったWEBページをLispでも!ShibuyalispTT#4 LT 他言語で作ったWEBページをLispでも!
ShibuyalispTT#4 LT 他言語で作ったWEBページをLispでも!
 
Clojure+Leiningenで3分Hadoop
Clojure+Leiningenで3分HadoopClojure+Leiningenで3分Hadoop
Clojure+Leiningenで3分Hadoop
 
CategoLJについて
CategoLJについてCategoLJについて
CategoLJについて
 
Ll tiger clojure
Ll tiger clojureLl tiger clojure
Ll tiger clojure
 
Thin Server Architectureでブログ作った #ikam
Thin Server Architectureでブログ作った #ikamThin Server Architectureでブログ作った #ikam
Thin Server Architectureでブログ作った #ikam
 
喋るJava!
喋るJava!喋るJava!
喋るJava!
 
Concourse CI Meetup Demo
Concourse CI Meetup DemoConcourse CI Meetup Demo
Concourse CI Meetup Demo
 

Similar to Spring Rooで作るGWTアプリケーション

Rails and twitter #twtr_hack
Rails and twitter #twtr_hackRails and twitter #twtr_hack
Rails and twitter #twtr_hack
i7a
 
13016 n分で作るtype scriptでnodejs
13016 n分で作るtype scriptでnodejs13016 n分で作るtype scriptでnodejs
13016 n分で作るtype scriptでnodejs
Takayoshi Tanaka
 
Sohu邮箱的python经验
Sohu邮箱的python经验Sohu邮箱的python经验
Sohu邮箱的python经验
Ryan Poy
 
Struts2を始めよう!
Struts2を始めよう!Struts2を始めよう!
Struts2を始めよう!
Shinpei Ohtani
 
環境構築自動化ツールのご紹介
環境構築自動化ツールのご紹介環境構築自動化ツールのご紹介
環境構築自動化ツールのご紹介
Etsuji Nakai
 
Cloudstack user group meeting in osaka
Cloudstack user group meeting in osakaCloudstack user group meeting in osaka
Cloudstack user group meeting in osaka
Naotaka Jay HOTTA
 

Similar to Spring Rooで作るGWTアプリケーション (20)

Myfirst cloudfoundry intro_20161201
Myfirst cloudfoundry intro_20161201Myfirst cloudfoundry intro_20161201
Myfirst cloudfoundry intro_20161201
 
Node予備校 vol.1 名古屋
Node予備校 vol.1 名古屋Node予備校 vol.1 名古屋
Node予備校 vol.1 名古屋
 
どこよりも早い Spring Boot 1.2 解説 #渋谷Java
どこよりも早い Spring Boot 1.2 解説 #渋谷Javaどこよりも早い Spring Boot 1.2 解説 #渋谷Java
どこよりも早い Spring Boot 1.2 解説 #渋谷Java
 
Wasm blazor and wasi 2
Wasm blazor and wasi 2Wasm blazor and wasi 2
Wasm blazor and wasi 2
 
Rails and twitter #twtr_hack
Rails and twitter #twtr_hackRails and twitter #twtr_hack
Rails and twitter #twtr_hack
 
React Native GUIDE
React Native GUIDEReact Native GUIDE
React Native GUIDE
 
PowerShellを使用したWindows Serverの管理
PowerShellを使用したWindows Serverの管理PowerShellを使用したWindows Serverの管理
PowerShellを使用したWindows Serverの管理
 
13016 n分で作るtype scriptでnodejs
13016 n分で作るtype scriptでnodejs13016 n分で作るtype scriptでnodejs
13016 n分で作るtype scriptでnodejs
 
RでつくるWebアプリ~rApache編~
RでつくるWebアプリ~rApache編~RでつくるWebアプリ~rApache編~
RでつくるWebアプリ~rApache編~
 
Sohu邮箱的python经验
Sohu邮箱的python经验Sohu邮箱的python经验
Sohu邮箱的python经验
 
VSCodeで始めるAzure Static Web Apps開発
VSCodeで始めるAzure Static Web Apps開発VSCodeで始めるAzure Static Web Apps開発
VSCodeで始めるAzure Static Web Apps開発
 
20081003
2008100320081003
20081003
 
Springでdao 20070413
Springでdao 20070413Springでdao 20070413
Springでdao 20070413
 
Struts2を始めよう!
Struts2を始めよう!Struts2を始めよう!
Struts2を始めよう!
 
環境構築自動化ツールのご紹介
環境構築自動化ツールのご紹介環境構築自動化ツールのご紹介
環境構築自動化ツールのご紹介
 
REST with Spring Boot #jqfk
REST with Spring Boot #jqfkREST with Spring Boot #jqfk
REST with Spring Boot #jqfk
 
Cloudstack user group meeting in osaka
Cloudstack user group meeting in osakaCloudstack user group meeting in osaka
Cloudstack user group meeting in osaka
 
Apache Torqueについて
Apache TorqueについてApache Torqueについて
Apache Torqueについて
 
分散環境におけるDocker とオーケストレーション
分散環境におけるDocker とオーケストレーション分散環境におけるDocker とオーケストレーション
分散環境におけるDocker とオーケストレーション
 
Node.jsv0.8からv4.xへのバージョンアップ ~大規模Push通知基盤の運用事例~
Node.jsv0.8からv4.xへのバージョンアップ ~大規模Push通知基盤の運用事例~Node.jsv0.8からv4.xへのバージョンアップ ~大規模Push通知基盤の運用事例~
Node.jsv0.8からv4.xへのバージョンアップ ~大規模Push通知基盤の運用事例~
 

More from Toshiaki Maki

マイクロサービスに必要な技術要素はすべてSpring Cloudにある #DO07
マイクロサービスに必要な技術要素はすべてSpring Cloudにある #DO07マイクロサービスに必要な技術要素はすべてSpring Cloudにある #DO07
マイクロサービスに必要な技術要素はすべてSpring Cloudにある #DO07
Toshiaki Maki
 
実例で学ぶ、明日から使えるSpring Boot Tips #jsug
実例で学ぶ、明日から使えるSpring Boot Tips #jsug実例で学ぶ、明日から使えるSpring Boot Tips #jsug
実例で学ぶ、明日から使えるSpring Boot Tips #jsug
Toshiaki Maki
 

More from Toshiaki Maki (20)

From Spring Boot 2.2 to Spring Boot 2.3 #jsug
From Spring Boot 2.2 to Spring Boot 2.3 #jsugFrom Spring Boot 2.2 to Spring Boot 2.3 #jsug
From Spring Boot 2.2 to Spring Boot 2.3 #jsug
 
Concourse x Spinnaker #concourse_tokyo
Concourse x Spinnaker #concourse_tokyoConcourse x Spinnaker #concourse_tokyo
Concourse x Spinnaker #concourse_tokyo
 
Serverless with Spring Cloud Function, Knative and riff #SpringOneTour #s1t
Serverless with Spring Cloud Function, Knative and riff #SpringOneTour #s1tServerless with Spring Cloud Function, Knative and riff #SpringOneTour #s1t
Serverless with Spring Cloud Function, Knative and riff #SpringOneTour #s1t
 
決済システムの内製化への旅 - SpringとPCFで作るクラウドネイティブなシステム開発 #jsug #sf_h1
決済システムの内製化への旅 - SpringとPCFで作るクラウドネイティブなシステム開発 #jsug #sf_h1決済システムの内製化への旅 - SpringとPCFで作るクラウドネイティブなシステム開発 #jsug #sf_h1
決済システムの内製化への旅 - SpringとPCFで作るクラウドネイティブなシステム開発 #jsug #sf_h1
 
Spring Boot Actuator 2.0 & Micrometer #jjug_ccc #ccc_a1
Spring Boot Actuator 2.0 & Micrometer #jjug_ccc #ccc_a1Spring Boot Actuator 2.0 & Micrometer #jjug_ccc #ccc_a1
Spring Boot Actuator 2.0 & Micrometer #jjug_ccc #ccc_a1
 
Spring Boot Actuator 2.0 & Micrometer
Spring Boot Actuator 2.0 & MicrometerSpring Boot Actuator 2.0 & Micrometer
Spring Boot Actuator 2.0 & Micrometer
 
Open Service Broker APIとKubernetes Service Catalog #k8sjp
Open Service Broker APIとKubernetes Service Catalog #k8sjpOpen Service Broker APIとKubernetes Service Catalog #k8sjp
Open Service Broker APIとKubernetes Service Catalog #k8sjp
 
Spring Cloud Function & Project riff #jsug
Spring Cloud Function & Project riff #jsugSpring Cloud Function & Project riff #jsug
Spring Cloud Function & Project riff #jsug
 
Introduction to Spring WebFlux #jsug #sf_a1
Introduction to Spring WebFlux #jsug #sf_a1Introduction to Spring WebFlux #jsug #sf_a1
Introduction to Spring WebFlux #jsug #sf_a1
 
BOSH / CF Deployment in modern ways #cf_tokyo
BOSH / CF Deployment in modern ways #cf_tokyoBOSH / CF Deployment in modern ways #cf_tokyo
BOSH / CF Deployment in modern ways #cf_tokyo
 
Why PCF is the best platform for Spring Boot
Why PCF is the best platform for Spring BootWhy PCF is the best platform for Spring Boot
Why PCF is the best platform for Spring Boot
 
Zipkin Components #zipkin_jp
Zipkin Components #zipkin_jpZipkin Components #zipkin_jp
Zipkin Components #zipkin_jp
 
マイクロサービスに必要な技術要素はすべてSpring Cloudにある #DO07
マイクロサービスに必要な技術要素はすべてSpring Cloudにある #DO07マイクロサービスに必要な技術要素はすべてSpring Cloudにある #DO07
マイクロサービスに必要な技術要素はすべてSpring Cloudにある #DO07
 
Spring Framework 5.0による Reactive Web Application #JavaDayTokyo
Spring Framework 5.0による Reactive Web Application #JavaDayTokyoSpring Framework 5.0による Reactive Web Application #JavaDayTokyo
Spring Framework 5.0による Reactive Web Application #JavaDayTokyo
 
実例で学ぶ、明日から使えるSpring Boot Tips #jsug
実例で学ぶ、明日から使えるSpring Boot Tips #jsug実例で学ぶ、明日から使えるSpring Boot Tips #jsug
実例で学ぶ、明日から使えるSpring Boot Tips #jsug
 
Spring ❤️ Kotlin #jjug
Spring ❤️ Kotlin #jjugSpring ❤️ Kotlin #jjug
Spring ❤️ Kotlin #jjug
 
Event Driven Microservices with Spring Cloud Stream #jjug_ccc #ccc_ab3
Event Driven Microservices with Spring Cloud Stream #jjug_ccc #ccc_ab3Event Driven Microservices with Spring Cloud Stream #jjug_ccc #ccc_ab3
Event Driven Microservices with Spring Cloud Stream #jjug_ccc #ccc_ab3
 
Managing your Docker image continuously with Concourse CI
Managing your Docker image continuously with Concourse CIManaging your Docker image continuously with Concourse CI
Managing your Docker image continuously with Concourse CI
 
Data Microservices with Spring Cloud Stream, Task, and Data Flow #jsug #spri...
Data Microservices with Spring Cloud Stream, Task,  and Data Flow #jsug #spri...Data Microservices with Spring Cloud Stream, Task,  and Data Flow #jsug #spri...
Data Microservices with Spring Cloud Stream, Task, and Data Flow #jsug #spri...
 
Short Lived Tasks in Cloud Foundry #cfdtokyo
Short Lived Tasks in Cloud Foundry #cfdtokyoShort Lived Tasks in Cloud Foundry #cfdtokyo
Short Lived Tasks in Cloud Foundry #cfdtokyo
 

Recently uploaded

2024年5月25日Serverless Meetup大阪 アプリケーションをどこで動かすべきなのか.pptx
2024年5月25日Serverless Meetup大阪 アプリケーションをどこで動かすべきなのか.pptx2024年5月25日Serverless Meetup大阪 アプリケーションをどこで動かすべきなのか.pptx
2024年5月25日Serverless Meetup大阪 アプリケーションをどこで動かすべきなのか.pptx
ssuserbefd24
 

Recently uploaded (10)

20240523_IoTLT_vol111_kitazaki_v1___.pdf
20240523_IoTLT_vol111_kitazaki_v1___.pdf20240523_IoTLT_vol111_kitazaki_v1___.pdf
20240523_IoTLT_vol111_kitazaki_v1___.pdf
 
LoRaWAN 4チャンネル電流センサー・コンバーター CS01-LB 日本語マニュアル
LoRaWAN 4チャンネル電流センサー・コンバーター CS01-LB 日本語マニュアルLoRaWAN 4チャンネル電流センサー・コンバーター CS01-LB 日本語マニュアル
LoRaWAN 4チャンネル電流センサー・コンバーター CS01-LB 日本語マニュアル
 
論文紹介: Offline Q-Learning on diverse Multi-Task data both scales and generalizes
論文紹介: Offline Q-Learning on diverse Multi-Task data both scales and generalizes論文紹介: Offline Q-Learning on diverse Multi-Task data both scales and generalizes
論文紹介: Offline Q-Learning on diverse Multi-Task data both scales and generalizes
 
YugabyteDB適用に向けた取り組みと隠れた魅力 (DSS Asia 2024 発表資料)
YugabyteDB適用に向けた取り組みと隠れた魅力 (DSS Asia 2024 発表資料)YugabyteDB適用に向けた取り組みと隠れた魅力 (DSS Asia 2024 発表資料)
YugabyteDB適用に向けた取り組みと隠れた魅力 (DSS Asia 2024 発表資料)
 
MPAなWebフレームワーク、Astroの紹介 (その2) 2024/05/24の勉強会で発表されたものです。
MPAなWebフレームワーク、Astroの紹介 (その2) 2024/05/24の勉強会で発表されたものです。MPAなWebフレームワーク、Astroの紹介 (その2) 2024/05/24の勉強会で発表されたものです。
MPAなWebフレームワーク、Astroの紹介 (その2) 2024/05/24の勉強会で発表されたものです。
 
【AI論文解説】Consistency ModelとRectified Flow
【AI論文解説】Consistency ModelとRectified Flow【AI論文解説】Consistency ModelとRectified Flow
【AI論文解説】Consistency ModelとRectified Flow
 
論文紹介: Exploiting semantic segmentation to boost reinforcement learning in vid...
論文紹介: Exploiting semantic segmentation to boost reinforcement learning in vid...論文紹介: Exploiting semantic segmentation to boost reinforcement learning in vid...
論文紹介: Exploiting semantic segmentation to boost reinforcement learning in vid...
 
2024年度_サイバーエージェント_新卒研修「データベースの歴史」.pptx
2024年度_サイバーエージェント_新卒研修「データベースの歴史」.pptx2024年度_サイバーエージェント_新卒研修「データベースの歴史」.pptx
2024年度_サイバーエージェント_新卒研修「データベースの歴史」.pptx
 
Amazon Cognitoで実装するパスキー (Security-JAWS【第33回】 勉強会)
Amazon Cognitoで実装するパスキー (Security-JAWS【第33回】 勉強会)Amazon Cognitoで実装するパスキー (Security-JAWS【第33回】 勉強会)
Amazon Cognitoで実装するパスキー (Security-JAWS【第33回】 勉強会)
 
2024年5月25日Serverless Meetup大阪 アプリケーションをどこで動かすべきなのか.pptx
2024年5月25日Serverless Meetup大阪 アプリケーションをどこで動かすべきなのか.pptx2024年5月25日Serverless Meetup大阪 アプリケーションをどこで動かすべきなのか.pptx
2024年5月25日Serverless Meetup大阪 アプリケーションをどこで動かすべきなのか.pptx
 

Spring Rooで作るGWTアプリケーション

  • 1. Spring Rooで作るGWT アプリケーション @making 2011/11/13
  • 2. Spring Rooとは  SpringベースのJavaアプリをコマンドラインでさくさ く作るためのRADツール  http://www.springsource.org/spring-roo  安定版は1.1.5.RELEASEが最新  開発版は1.2.0.M1が最新  今回の説明は1.2系で!  コマンドを叩くとJavaソースコード、XML設定ファイ ル、Maven依存関係の追加などを行ってくれる。 Scaffoldも
  • 3. 入門記事  この辺でGetting Started  http://www.ibm.com/developerworks/jp/opensource/libr ary/os-springroo1/index.html  http://www.atmarkit.co.jp/fjava/index/index_springroo.ht ml
  • 4. Rooアプリの構成 Web層 サービス層 永続化層 データベース • Spring MVC • JPA • MySQL • GWT • Hibernate • PostgreSQL • Vaadin(addon) • EclipseLink • Oracle • Flex (addon) • TopLink • H2 • DataNucleus • HyperSonic • JMS • GAE 1.2からサービス層、レポジトリ層が追 • MongoDB 加
  • 7. Spring Rooプロジェクト作成 $ mkdir pizza $ cd pizza $ roo.sh # プロジェクト作成 roo> project --topLevelPackage com.example.pizza # 永続化層(JPA)の定義 roo> jpa setup --provider HIBERNATE --database HYPERSONIC_IN_MEMORY
  • 8. エンティティ層の定義 # エンティティ作成 roo> entity --class ~.domain.Topping –testAutomatically roo> field string --fieldName name --notNull --sizeMin 2 roo> entity --class ~.domain.Base –testAutomatically roo> field string --fieldName name --notNull --sizeMin 2 roo> entity --class ~.domain.Pizza –testAutomatically roo> field string --fieldName name --notNull --sizeMin 2 roo> field number --fieldName price --type java.lang.Float
  • 9. 一対多の定義 roo> field set --fieldName toppings --type ~.domain.Topping
  • 10. 一対一の定義 roo> field reference --fieldName base --type ~.domain.Base
  • 11. もう一個 roo> entity --class ~.domain.PizzaOrder --testAutomatically roo> field string --fieldName name --notNull --sizeMin 2 roo> field string --fieldName address --sizeMax 30 roo> field number --fieldName total --type java.lang.Float roo> field date --fieldName deliveryDate --type java.util.Date roo> field set --fieldName pizzas --type ~.domain.Pizza
  • 12. ログ project --topLevelPackage com.example.pizza jpa setup --provider HIBERNATE --database HYPERSONIC_IN_MEMORY entity --class ~.domain.Topping --testAutomatically field string --fieldName name --notNull --sizeMin 2 entity --class ~.domain.Base --testAutomatically field string --fieldName name --notNull --sizeMin 2 entity --class ~.domain.Pizza --testAutomatically field string --fieldName name --notNull --sizeMin 2 field number --fieldName price --type java.lang.Float field set --fieldName toppings --type ~.domain.Topping field reference --fieldName base --type ~.domain.Base entity --class ~.domain.PizzaOrder --testAutomatically field string --fieldName name --notNull --sizeMin 2 field string --fieldName address --sizeMax 30 field number --fieldName total --type java.lang.Float field date --fieldName deliveryDate --type java.util.Date field set --fieldName pizzas --type ~.domain.Pizza
  • 14. Web層の定義  通常(Spring MVCアプリ)は roo> web mvc setup roo> web mvc all --package ~.web  GWTの場合 roo> web gwt setup roo> web gwt all --proxyPackage ~.client.proxy --requestPackage ~.client.request ScaffoldなCRUDアプリが自動生成される
  • 17. ここから先は  未調査!  どうやって画面を使いするの?  次回に続く?
  • 18. 参考情報  http://spring-roo- repository.springsource.org/Getting_Started_with_Roo. pdf  オライリー本のPDFがダウンロードできます。  オライリーで買うと$14.99。。どういうことだってばよ
  • 20. 付録  Spring RooのGWTコマンド web gwt all - すべてのエンティティをプロジェクトに配置して GWT リクエストとプロキシを生成し, 処理の基盤を構成する web gwt gae update - GWT プロジェクトを更新して,GAE サポートを追加する web gwt proxy all - すべてのエンティティをプロジェクトに配置して GWT プロキシを生成する web gwt proxy request all - すべてのエンティティをプロジェクトに配置して GWT リクエストとプロ キシを生成する web gwt proxy request type - 指定された型をベースとするプロキシとリクエストを生成する web gwt proxy type - 指定された型をベースとする GWT プロキシを生成する web gwt request all - すべてのエンティティをプロジェクトに配置して GWT リクエストを生成する web gwt request type - 指定された型をベースとする GWT プロキシを生成する web gwt scaffold - GWT リクエストとプロキシ,および指定された基盤を生成する http://www.infoq.com/jp/news/2011/10/spring-roo-1.2-m1-asl-jpa-mongo より