Spring Roo

Today I found out about the existence of Spring Roo. A really cool project that certainly fills a sweet spot between what IDE´s and build tools will do for you.

What is Spring Roo: as they say it “a little man that does all stuff you do not want to worry about”.

This translates to CODE GENERATION through a Spring Roo command shell environment.

Example goal: create a wedding RSVP application, including persistence using JPA and Hibernate. Take these steps:

1. create a directory named wedding

2. fire up Roo

3. type “create project” (Roo now creates a Maven 2 project)

4. type “persistence setup –provider HIBERNATE –database HYPERSONIC_PERSISTENT” (this creates all xml and properties files)

5. type the following to fill the database with something:

entity –name ~.domain.Rsvp

field string code –notNull –sizeMin 1 –sizeMax 30

field string email –sizeMax 30

field number attending –type java.lang.Integer

field string specialRequests –sizeMax 100

field date confirmed –type java.util.Date

6. Add a web tier: “controller scaffold ~.web.RsvpController”

7. See what we got! “mvn tomcat:run”

That´s (roughly) it, in just a few steps we have a working web application that conforms to the standards and includes unit tests!

Example taken from the Spring Roo site.

Leave a Reply

Your email address will not be published. Required fields are marked *