Screen Shot 2013-04-28 at 4.41.13 PM

I gave an introduction talk on the Spring Roo project at the Queensland JVM Meeting. I like Spring Roo for bootstrapping a new project and JSON Api for existing databases. It was a brief introduction for the JVM group as the previous speaker could not make it; it may not be as polished as usual but I hope you still find it useful.

Here are the slides:

Here is the Video:


And here is the Roo Script that we walked through and I also demonstrated the actual site:

( roo script is here)

Screen Shot 2013-04-28 at 4.29.37 PM

persistence setup --provider HIBERNATE --database HYPERSONIC_IN_MEMORY

//Sets up the database configuration

enum type --class ~.reference.PetType
enum constant --name Dog
enum constant --name Cat
enum constant --name Bird
enum type --class ~.reference.Specialty
enum constant --name Cardiology
enum constant --name Dentistry
enum constant --name Nutrition

//Set up some Enumerations for drop downs.

entity jpa --class ~.domain.Pet --testAutomatically
entity jpa --class ~.domain.Visit --testAutomatically
entity jpa --class ~.domain.AbstractPerson --abstract
entity jpa --class ~.domain.Vet --extends ~.domain.AbstractPerson --testAutomatically
entity jpa --class ~.domain.Owner --extends ~.domain.AbstractPerson --testAutomatically

//Shows how to do inheritance and abstract classes.

field string --fieldName firstName --sizeMin 3 --sizeMax 30 --class ~.domain.AbstractPerson
field string --fieldName lastName --notNull --sizeMin 3 --sizeMax 30
field string --fieldName address --notNull --sizeMax 50 --sizeMin 1
field string --fieldName city --notNull --sizeMax 30
field string --fieldName telephone --notNull
field string --fieldName homePage --sizeMax 30
field string --fieldName email --sizeMax 30 --sizeMin 6
field date --fieldName birthDay --type java.util.Date --notNull
field string --fieldName description --sizeMax 255 --class ~.domain.Visit
field date --fieldName visitDate --type java.util.Date --notNull --past
field reference --fieldName pet --type ~.domain.Pet --notNull
field reference --fieldName vet --type ~.domain.Vet
field boolean --fieldName sendReminders --notNull --primitive --class ~.domain.Pet
field string --fieldName name --notNull --sizeMin 1
field number --fieldName weight --type java.lang.Float --notNull --min 0
field reference --fieldName owner --type ~.domain.Owner
field enum --fieldName type --type ~.reference.PetType --notNull
field date --fieldName employedSince --type java.util.Calendar --notNull --past --class ~.domain.Vet
field enum --fieldName specialty --type ~.reference.Specialty --notNull false

//This shows how to add fields and restrictions that will be reflected in the scaffolded pages

Screen Shot 2013-04-28 at 4.52.00 PM

//Shows how to do relations

field set --class ~.domain.Owner --fieldName pets --type ~.domain.Pet --mappedBy owner --notNull false --cardinality ONE_TO_MANY
finder add --finderName findPetsByNameAndWeight --class ~.domain.Pet
finder add --finderName findPetsByOwner
finder add --finderName findPetsBySendRemindersAndWeightLessThan
finder add --finderName findPetsByTypeAndNameLike
finder add --finderName findVisitsByDescriptionAndVisitDate --class ~.domain.Visit
finder add --finderName findVisitsByVisitDateBetween
finder add --finderName findVisitsByDescriptionLike

//This shows who it can generate the finders for the entities, can use ‘finder list’ to see whats available

web mvc setup
web mvc all --package ~.web

//Set up the scaffolding framework; and then do the entities

web mvc finder all --package ~.web

//Now do the finder methods.

web mvc language --code de
web mvc language --code es

//Lets setup the international files

selenium test --controller ~.web.OwnerController
selenium test --controller ~.web.PetController
selenium test --controller ~.web.VetController
selenium test --controller ~.web.VisitController

//Create Tests

Screen Shot 2013-04-28 at 4.41.13 PM

logging setup --level INFO

//Set Log level

//Enable json service

json all

//Create Json aspects

web mvc json all

//Create Json aspect for Controller.

//Add Security After first run

//security setup


We just update the project for maven to download the dependencies and run ‘mvn tomcat:run’ to a functional MVC application in minutes.

About drogan