Spring Roo 1.2 M1: Apache Licensed with JPA Repositories, MongoDB and Services Layer
SpringSource has released Spring Roo 1.2.0.M1. Spring Roo is an open source, rapid application development tool that uses convention-over-configuration principles to create Spring-based Java applications. New in this release are:
- Improved Performance
- Released under Apache Software License 2
- Hosted in GitHub
- Spring Data JPA Repository
- MongoDB Repository
- Services Layer
- Improved GWT Support
- Multi-Schema Database Reverse Engineering
- Shell Improvements
Spring Roo's performance for large benchmark projects has increased by a factor of 10. This has been achieved through attention to profiling, file monitoring, disk I/O, XML models and round-tripping. This speed improvement will be most noticeable when working with large projects.
Spring Roo is now licensed under the Apache Software License (ASL) 2, making it consistent with most of the other Spring projects. ASL is a more permissive license and is conducive to commercial development, closed-source integration and proprietary redistribution. Spring Roo used to be primarily licensed under GPL 3, while the annotation JARs are licensed under ASL 2 and GPL 3.
Spring Roo is now hosted on GitHub, the popular Git hosting service. The primary goal for moving to GitHub is to encourage more Spring Roo community involvement. GitHub will also help simplify the receipt of new contributions from the community. Spring Roo's GitHub page can be found at https://github.com/SpringSource/spring-roo.
Spring Roo now gives you the ability to define your own repository layer approach. The default data access pattern is still the "Active Record"-style JPA persistent domain entities. You can now also use the more traditional approach of using JPA repositories, backed by Spring Data JPA. You configure your Entities by setting the activeRecord parameter to true or false during Entity creation.
entity --class ~.domain.Entity --activeRecord [true|false]
Another repository option available in Roo is MongoDB, backed by Spring Data MongoDB. MongoDB is a scalable, high-performance, document-oriented database. If you wish to use NoSQL with Spring Roo, this is the way to go. The following Roo commands have been introduced.
mongo setup - Configures the project for MongoDB peristence. entity mongo - Creates a domain type which can be backed by a MongoDB repository. repository mongo - Adds @RooRepositoryMongo annotation to target type.
Spring Roo has also added services layer support. This highly-requested community feature allows you to add a services layer using the @RooService annotation, hiding data access code from controllers. Roo-managed web tiers, repositories and tests are fully aware of this new service layer. The following Roo command has been introduced.
service - Adds @RooService annotation to target type
Here's a Spring Roo diagram that displays the new service and persistence layers.
For a more in-depth look at the new Spring Roo layers, read the "New application layering and persistence choices in Spring Roo 1.2" blog post from SpringSource.
Spring Roo has improved GWT support. Now you can let Spring Roo manage syncing your RequestFactory classes (EntityProxy, RequestContext, and Locator) with your domain model and service layers. GWT UI scaffolding is no longer mandatory, so you can choose how Spring Roo integrates GWT with your project. The following Spring Roo commands have been introduced.
web gwt all - Locates all entities in the project and creates GWT requests, proxies and creates the scaffold. web gwt gae update - Updates the GWT project to support GAE. web gwt proxy all - Locates all entities in the project and creates GWT proxies. web gwt proxy request all - Locates all entities in the project and creates GWT requests and proxies. web gwt proxy request type - Creates a proxy and request based on the specified type. web gwt proxy type - Creates a GWT proxy based on the specified type. web gwt request all - Locates all entities in the project and creates GWT requests. web gwt request type - Creates a GWT proxy based on the specified type. web gwt scaffold - Creates a GWT request, proxy and scaffold for the specified.
A popular feature in Spring Roo is Database Reverse Engineering (DBRE) support. This allows you to scaffold an entity model from your relational schema, and automatically maintain that entity layer as the schema changes. What's new in Spring Roo 1.2 is the ability to reverse engineer multiple database schemas at the same time. A multiple schema command looks something like:
database reverse engineer --schema "s1 s2 s3" --includeTables "s1.table1 s1.table2 s3.table3"
There also have been shell improvements in Spring Roo. Backspace to a previous line now works. You can also run operating system commands directly from the Roo shell via the "!" operator.
! - Allows execution of operating system (OS) commands.
To be included in the next Spring Roo 1.2 milestone release are highly-requested community features like JSF/PrimeFaces and Multi-module Maven support. There will be a new Roo addon for JSF 2.0 views using Facelets templates instead of JSPs. There will also be a new Roo addon that can create multi-module Maven projects.
You can start exploring these new features by downloading Spring Roo 1.2 M1 from SpringSource. Note that is a milestone release and it's recommended that you keep using Roo 1.1.5 for production projects. For more information, visit the official Spring Roo website and the Spring Roo community forum.
Ruslan Meshenberg Sep 21, 2014