Bookmark Topic Watch Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
  • Mike London
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Overview: What is Spring Roo?

Roo is a command-line utility that generates and maintains spring-based applications. It is a highly interactive tool, meant to be run while the application is under development. The command line tool is called the RooShell.

Features you can build into / manage with Spring Roo projects:

  • Spring MVC support (by adding a controller to the project)
  • Spring JMS support (installs ActiveMQ and listeners)
  • Email support using email templates
  • (coming) Flex and GWT client support
  • Any additional Maven libraries (it's just a Spring & Maven project, after all)
  • More add-ons are being developed by both SpringSource and third-party developers.

  • Questions:

    Why does Spring Roo use AspectJ?

    Spring Roo actually uses AspectJ's new Inter-Type Declaration (ITD) feature to automatically generate and maintain boilerplate code. You can have Spring Roo generate your MVC controllers and views for JPA entities using a simple roo command, controller scaffold, and then Roo will create both the Class you requested, and a shadow AspectJ ITDs for functionality such as handling all CRUD operations.

    For a Controller named CustomerController.class, Roo will generate a shadow ITD named CustomerController_Roo_Controller.aj. These files should not be edited by users. Developers can choose to Push-In Refactor these features back into the class definition and remove one or all Roo generated methods from the .aj files.

    Other classes use ITDs - Roo Entities use a set of at least four, including _Roo_JavaBean.aj, _Roo_Entity.aj, _RooToString.aj and _RooConfigurable.aj. All of these ITDs are mixed-in to the target class at compile time, using the AspectJ compiler.

    So the short answer is that Roo uses AspectJ to separate boilerplate, generated code, which may be quickly scaffolded and modified, away from the target class files to reduce the visible complexity, and allow developers to focus on the business logic.

    When should I run the Roo Shell?

    You should keep the Roo shell running during a development session continually, if you plan on modifying Roo-managed classes (classes that are annotated with Roo-specfiic annotations such as @RooController, @RooEntity, and @RooIntegrationTest, for example.

    Should I commit the .aj files to my source control system?

    No. These are considered part of the build process and can be generated by simply running Roo and quitting. An integration test server such as Hudson can issue a command line call prior to building the maven build file such as "roo quit", which will run the shell, synchronize any changes needed to the ITDs, and then quit. Then it can perform a mvn install to finish the build process.

    What IDEs support Spring Roo?

    Currently, SpringSource Tool Suite is loaded to support Spring Roo out of the box in the STS 2.3.3 milestone releases. IntelliJ IDEA supports Spring Roo using the Maia builds and some AspectJ plugins. NetBeans does not support ITD files, and the AspectJ support is a bit old. You can attempt to load the AJDT (AspectJ Developer Tools) on a standard Eclipse installation, and with recent vintage it is said you can get it to wire up ITDs.

    Isn't all this wiring slowing down my code?

    Not necessarily. ITDs are compile-time facilities - the actual code in these generated .aj files actually is compiled into the bytecode of the target classes. Interestingly, Spring Roo uses an AspectJ compiler version of transaction management, which should be faster than the traditional Spring proxy mechanism (need to verify this!)

    What about add-ons? Is there a repository?

    Coming soon, in 1.1.0.M3, the Roo team will be deploying an add-on repository. For now, developers are pushing messages to places such as Twitter (see resources below) and committing projects to and other repositories.

    What stage is Roo in today?

    Of course, this will need to be updated. First cut is on July 21, 2010. Roo can be used to quickly start a Spring project, and while some areas are being refactored and need some work, you can leave in or remove as much of Roo as you want. Some developers are using Spring Roo to quickly prototype technologies in their development process, such as interaction with JMS, JPA and Spring MVC 3.

    The Spring MVC area is being innovated on quite a bit. Spring Roo deploys XML-compilant tag libraries for forms and fields, and while the support is not 100% complete for all widget types yet (such as radio button choices) you can supply your own tags and work in what you need. The team has already configured applications to support Tiles templates, XML-compliant JSP files (known as JSPX files) and localization, to name a few features.

    You will have to spend some time unfolding the conventions used by the web framework as of 1.1.0.M2, but the tag libraries are a huge innovation. SpringSource suggests 1.1.0.M2 is not 100% "production ready" in that there may be defects that can stop you in certain areas, but in the end, you can push in Roo and just continue on with Spring, if you want to.

    Useful links:

  • Learning Roo
  • Twitter accounts @SpringRoo and @RooInAction
  • Roo Forums
  • The Roo JIRA Queue - good place to hang out and read what the team is thinking...
  • The Roo Blog Entries at
  • The Spring Roo Podcast
  • Roo reference

  • Current Publishing Efforts:

  • Manning's Roo in Action by Gordon Dickens and Ken Rimple. ETA Spring 2011, MEAP available.
  • Packt's Spring Roo Cookbook by Ashish Sarin.

      Bookmark Topic Watch Topic
    • New Topic