Friday, October 23, 2009

A first look at Spring Roo

I have finally found the time to have a look at Spring Roo. Generating a JPA model and some controllers for it took next to no time even without reading the documenation. What really surprised me was the extensive use of Aspect/J in the generated code.
For every bean Roo generated four Aspect/J files so that my Java bean contained only the private fields and  annotations. Getters and Setters were added as aspects. So was the generated ID field, the toString method and some finder methods.
The generated Spring MVC controller was also divided into a nearly empty Java class and an Aspect/J file containing all the necessary methods for a CRUD application, e.g.
@RequestMapping(value = "/place/form", method = RequestMethod.GET)    
public String PlaceController.createForm(ModelMap modelMap) {    
    modelMap.addAttribute("place", new Place());        
    return "place/create";        
}   

While this certainly keeps the generated Java source clean I’m not quite certain if I like this heavy reliance on aspects. It’s a nice showcase for what can be done with Aspect/J but I wonder how difficult it will be to maintain a Roo application. Guess I’ll have to play around with it a little more…