Tuto 2 Spring Roo
First Application With SpringRoo
1)Create the folder of your project:
$ mkdir first-app
$ cd first-app
$ roo
2)hint Command:
$roo>hint
=>the output from the "hint" command guides you through what to do next.
3)Create the topLevel Package:
$roo> project --topLevelPackage slm.abdennour.springroo.firstapp
NOTE : Don't Forget (Tab) Key .
4)Create Data Access Layer:
SpringRoo create the Data Access Layer by developement of domain objects (JPA entities):
Let's Choose Hibernate as provider
a*Create DataBase :
$roo> jpa setup --provider HIBERNATE --database HYPERSONIC_IN_MEMORY
NOTE : Don't Forget hint's Command between Steps $roo> hint .
b*Create Entities of DataBase :
As it's the first Application , Database has one entity which has two fields
for Example: the entity is person , and the fields are firstname and lastname.
roo> hint
$roo> field string --fieldName firstname --notNull
$roo> field string --fieldName firstname --notNull
5)Create Presentation Layer:
$roo> field string --fieldName firstname --notNull
5)Create Presentation Layer:
Creating RESTful Spring MVC web controllers is quick and easy using Roo.
$roo> web mvc setup
$roo> web mvc all --package ~.web
with the web mvc setup command the nature of the project changes from a normal Java project nature to a Web project nature
5)Selenium Tests:
The generated tests are located in the
with the web mvc setup command the nature of the project changes from a normal Java project nature to a Web project nature
5)Selenium Tests:
The generated tests are located in the
src/main/webapp/selenium
folder and can be run via the following maven command
roo> selenium test --controller ~.web.PersonController
roo> perform tests
6)Deploy:
deploying your web project is to create .war file from the project .
To create war File ,Execute this Command
$roo> perform package
NOTE : this Command can take some time to finish .
7)Convert to Eclipse Project :
(perform eclipse) allows project import via eclipse
$roo>perform eclipse
it's equivalent to :
$mvn eclipse:eclipse
6)Deploy:
deploying your web project is to create .war file from the project .
To create war File ,Execute this Command
$roo> perform package
NOTE : this Command can take some time to finish .
7)Convert to Eclipse Project :
(perform eclipse) allows project import via eclipse
$roo>perform eclipse
it's equivalent to :
$mvn eclipse:eclipse
8)Run Project in Application Server
>>Exit roo by this Command .
$roo> quit
>>Run
$mvn tomcat:run
9)Result
No comments:
Post a Comment