Spring Roo – JEE’s own command line Visual Studio

1 Dec

Testing testing does this thing work? My first blog entry on BSG Dev 🙂

So what is this Spring Roo hype all about?

Last night decided to download Spring Roo and be cool like all the other kids. So while it download read up on Spring Roo Introduction. In summary:

  1. Spring Roo is a tool that helps rapidly building Java enterprise applications by generating the plumbing code such as data base connection.
  2. As a Java developer you should use it because:
    1. It increases your productivity by enabling you build Java enterprise applications in a best-practice manner within minutes.
    2. It uses standard Java technologies that are used in enterprise Java projects such as Spring Framework, Hibernate JPA implementation and GWT.
    3. It adds the technologies incrementally. e.g. Java Persistence API is only added when you request it.
    4. It allows you to choose which implementation of an API to use. You could choose to use GWT or Spring MVC and you can also choose which database your application will use.
    5. It is easy to use and learn. There is a TAB for auto completion and hint command that suggests what you might want to do.
    6. It only adds used dependencies to your project thus reducing size of deployed war / jar file.
    7. It uses annotation-based dependency injection, and automatically providing dependency injection on entities. This reduces xml and Java files to maintain.
    8. It is easy to remove.
    9. You could create a simple GWT application that saves data to database in 10 minutes!

Pre-Requisites

In order to install Roo you need the following technologies installed on your machine:

  1. Maven
  2. Java 5 / 6

10 Minutes GWT Application Test

Assuming that you have Roo installed the following commands would get you a GWT application that Stores contacts names and phone numbers in a mysql database.

  1. Create contacts database in mysql:
    1. mysql -u<<username>> -p<<password>>
    2. create database <<databaseName>>
    3. exit
  2. Create project directory:
    1. mkdir ten-minute-gwt
    2. cd ten-minute-gwt
  3. Use Roo to create the gwt project:
    1. roo
    2. project –topLevelPackage za.co.bsg.tenminute
    3. persistence setup –provider HIBERNATE –database MYSQL –userName <<username>> –password <<password> –databaseName <<databaseName>>
    4. entity –class ~.model.Contact
    5. field string –fieldName name –column nme –notNull
    6. field string –fieldName telephone –column telephone –notNull
    7. gwt setup
    8. exit
  4. Use maven to run application:
    1. mvn gwt:run
  5. Click launch in default browser to see  application.

Conclusion

There are other plumbing features of Roo that still need testing namely:

  1. SMTP
  2. Security
  3. JMS

References:

  1. http://static.springsource.org/spring-roo/reference/html/index.html
  2. http://www.bytespring.com/blog/spring-roo-integration-gwt
Advertisements

One Response to “Spring Roo – JEE’s own command line Visual Studio”

Trackbacks/Pingbacks

  1. Tweets that mention Spring Roo – JEE’s own command line Visual Studio « BSG Dev -- Topsy.com - December 2, 2010

    […] This post was mentioned on Twitter by Ben Alex, Mya Z. Mya Z said: So what is this Spring Roo hype all about? https://bsgdev.wordpress.com/2010/12/01/spring-roo-jees-own-command-line-visual-studio/ #java […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: