Spring Roo
Spring Roo is an open-source software tool that uses convention-over-configuration principles to provide rapid application development of Java-based enterprise software. The resulting applications use common Java technologies such as Spring Framework, Java Persistence API, Thymeleaf, Apache Maven and AspectJ. Spring Roo is a member of the Spring portfolio of projects.
Motivation and history
Spring Roo's mission statement is to "fundamentally improve Java developer productivity without compromising engineering integrity or flexibility".The technology was first demonstrated during the opening keynote at the SpringOne Europe developer conference on 27 April 2009, with an initial alpha release concurrently being published. During the keynote an application was built live on-stage that would be used by conference attendees to vote on the preferred name for the project. Ultimately the name "Spring Roo" was preferred over alternatives including Spring Boost, Spring Spark, Spring HyperDrive and Spring Dart.
Several releases followed, with the Roo 1.0.0.RELEASE released in December 2009. In October 2010, Spring Roo 1.1.0.RELEASE was released. The 1.1.0 release moved to an OSGi foundation with associated add-on discovery model, plus added support for incremental database reverse engineering, Spring MVC page complexity reduction, Google Web Toolkit, Google App Engine, Apache Solr, JSON and smaller features like serializable automation. The current Roo project engineers are employed by SpringSource and as such Roo releases typically support the latest available releases of other Spring portfolio projects.
In 2014 takes over the leadership of the open source framework Spring Roo after the partnership agreement with Pivotal.
They collaborate on further development of the Spring Roo project. Roo will continue in its goal of providing a code-gen style of RAD framework.
The Spring Roo project will remain as an open source project under Spring, maintaining the same current licensing policy. Both Pivotal and DISID are calling on the Spring and Java communities for anyone who would like to collaborate in the project.
Standards and technology compatibility
Roo's default installation facilitates the creation of applications that comply with the following standards and major technologies:- Apache ActiveMQ
- Apache Maven
- Apache Tomcat
- AspectJ
- AspectJ Development Tools
- Bootstrap
- Cloud computing
- Eclipse IDE
- EclipseLink
- Hibernate
- Java Bean Validation
- Java API for XML Web Services
- Java Message Service
- Java Persistence API
- Java Transaction API
- Java. Java 7 is supported since Roo 1.2.4.
- JQuery
- JSON
- JUnit
- Log4J
- OSGi
- Representational State Transfer
- Spring Boot
- Spring Data JPA
- Spring Framework
- Spring Security
- Spring Web Flow
- SpringSource Tool Suite
- Thymeleaf
User interface
Spring Roo's main user interface is a command-line shell. The shell provides both a command-line interface and also a mechanism to host plug-ins. One key design goal of Roo is to ensure a user can continue to work in a "natural way", which typically means using their preferred integrated development environment or text editor for most tasks. As such Roo is often loaded in a separate window to the IDE or text editor, and will monitor the file system for changes made by the user outside of Roo. A startup-time scan of a user's project is also performed to determine any changes that may have been made while Roo was not running.The user interface shell supports extensive usability features including command-line completion, online help, hinting and contextual awareness. This allows a user to create a new software project via the Roo shell, or use Roo on an existing project. The following is an example of the commands used by Roo to create a new application plus the Spring Boot Maven plugin run goal to compile and run the application using an embedded HTTP server:
$ mkdir hello
$ cd hello
$ roo.sh
roo> project setup --topLevelPackage com.foo
roo> jpa setup --provider HIBERNATE --database HYPERSONIC_IN_MEMORY
roo> entity jpa --class ~.domain.Timer
roo> field string --fieldName message --notNull
roo> repository jpa --all
roo> service --all
roo> web mvc setup
roo> web mvc view setup --type THYMELEAF
roo> web mvc controller --all --responseType THYMELEAF
roo> web mvc controller --all --pathPrefix /api
roo> quit
$ mvn spring-boot:run
The above commands did not need to be typed in full, but rather were completed using TAB. Additionally, the "hint" command could have been used to acquire help at any time.
Architecture
While there are many ways that software can automatically generate code, Roo operates by generating AspectJ inter-type declarations. This achieves separation of concerns, as the code maintained by Roo is in a different compilation unit from the code a user writes. This means Roo can incrementally modify the AspectJ inter-type declarations that it needs to and leave all other files intact.Spring Roo uses add-ons to provide all the functionality within and on top of an OSGi runtime system based on Apache Felix.
Base add-ons
There are numerous commands available in Roo, depending on which "base add-ons" and "third-party add-ons" have been installed. The base add-ons shipping with Roo 2.0.x include:- Add-On Creator: enables easy creation of third-party Roo add-ons
- Backup: enables backups to be made to a ZIP file by typing
backup
- Bean Info: exposes JavaBean property, accessor and mutator metadata
- Configurable: introduces Spring Framework's @Configurable annotation
- Database reverse engineering: allows incremental reverse engineering of relational databases
- Data on Demand: provides seed data that is compliant with JSR 303 annotations present in entities
- DTO: extensive support for automatically maintaining Data Transfer Objects
- Email: simplifies setup of SMTP-based emails and mail sender support via Javamail
- Entity: extensive support for automatically maintaining Java Persistence API @Entity classes
- Java Bean: automatically maintains JavaBean getters/setters for classes with an @RooJavaBean annotation
- JDBC: encapsulates OSGi-compliant access to JDBC drivers shipped in different bundles
- JMS: simplifies connecting to a JMS provider and sending/receiving JMS messages
- JPA: installs a specified JPA provider and sets up JDBC accordingly
- JSON: adds JSON related serialization and deserialization methods to POJOs
- Logging: sets up Log4j, including command-based log level configuration
- Pluralization: provides pluralization of nouns
- Property Editor: manages property editors, as required by Spring MVC
- Property File: manages Java properties files and provides shell commands to read, set and remove property values
- Security: sets up Spring Security, including login pages, filters and dependencies
- Test: produces JUnit integration tests for project classes
- ToString: produces a valid toString method for any class with the @RooToString annotation
- Web Flow: installs the Spring Web Flow and creates a default flow
- Web MVC: maintains the view layer based on Spring MVC plus Thymeleaf templates and the RESTful API
- WS: produces SOAP services and SOAP clients
Roo core modules
- Support: used by core modules and add-ons for common utility class support services
- Metadata: provides a metadata service provider interface and implementation that includes dependency registration and caching
- File monitor: publishes events following detected file system changes
- File undo: provides a file undo facility for use by the process manager
- Project: abstracts typical end user project build systems like Apache Maven and Apache Ant
- Process manager: offers an ACID-like file system abstraction that includes disk rollback and process synchronization
- Classpath: performs abstract syntax tree parsing and type binding of Java and AspectJ compilation units
- Felix: integrates with Apache Felix, such as providing "osgi" commands in the Roo shell
- OBR: adds Apache Felix OSGi Bundle Repository capabilities
- URL Stream: encapsulates access to downloads in different host environments and enforces the Pretty Good Privacy-based httppgp:// protocol handler
Differentiation
- Java platform productivity: Roo provides a productivity solution for Java developers. It does not require the user to program in any language other than Java. It also uses mainstream Java enterprise application standards and technologies to maximize reuse of existing developer knowledge, skills and experience.
- Usability: Roo's shell is designed to provide a discoverable, easy-to-use environment that minimizes training requirements. Roo annotations all start with @Roo to facilitate code assist. Users can use their IDE for all operations and do not need to be aware of Roo running. Roo also supports users editing their files when Roo is not running.
- No runtime: Roo does not provide a runtime API or require specific runtime components. This ensures there is no Roo-related CPU, memory and disk storage resource consumption at runtime. Roo code is optimized for small-footprint cloud deployment and high scalability use cases.
- Avoids lock-in: Roo can be rapidly removed from a user project, which is useful to protect against vendor lock-in. This is possible because there is no runtime component to remove, @Roo annotations are "source retention" only and Roo's AspectJ inter-type declarations can be "pushed in" to standard *.java compilation units.
- Extensibility: Roo's separation of core infrastructure and base add-ons intends to allow third parties to easily extend Roo.