Java Spring Roo

From Objectif Client Inc
Revision as of 20:50, 1 December 2014 by Nicolas Rollin (talk | contribs)
Jump to navigation Jump to search

Installation

First Application

Create application from Database

  1. Assuming Roo is installed
  2. Validate with the roo addon manager if Mysql is already install org.springframework.roo.wrapping.mysql
  3. You may have to copy mysq.coonector.jar directly into the folder bundle in the roo installation directory

Install Mysql Driver

addon search mysql
 addon install id 01
  • If it goes wrong
osgi obr url add --url http://spring-roo-repository.springsource.org/repository.xml
osgi obr deploy --bundleSymbolicName org.springframework.roo.wrapping.mysql-jdbc 
  • If it goes very wrong

Copy mysql-connect.jar into bundle directory of the root installation repository

Create project

project --topLevelPackage com.objclt.roo.sample

Create Database Connection

  • Create persistence.xml and database.properties
persistence setup --provider HIBERNATE --database MYSQL --databaseName databaseName --hostName hostname --userName username --password password

Validate database.properties

jdbc.driverClassName=com.mysql.jdbc.Driver
jdbc.url=jdbc\:mysql\://localhost\:3306/Database_Name
jdbc.usernameDatabase_User
jdbc.password=User_Password

Validate persistence.xml

  • Si operation is not mandatory as is will be replaced when generating entities from database
  • Replace create by validate inside persistence.xml to disable the auto database creation
"Before"
property name="hibernate.hbm2ddl.auto" value="create"
"After"
property name="hibernate.hbm2ddl.auto" value="validate"

Test Database Connection

  • Will generate the dbrx.xml
database introspect --schema DatabaseSchema

Reverse engineering of the database

Create Java Entity and AspectJ source

database reverse engineer --schema DataBaseShema --package com.objclt.roo.sample

Perform Junit Integration

 test integration 

Configure Web presentation Layer

web mvc setup

Generate Controller

web mvc all --package ~.web

Setup Security

  • Create applicationContext-security.xml
security setup

Email Setup

  • Create email.properties
email sender setup --hostServer smtp.gmail.com --username \
<Your email address> --password <Your email password> --port 587 --protocol SMTP

Integration into eclipse

perform eclipse