Chapter 1. Getting Started with Spring Roo

In this chapter, we will cover the following topics:

  • Setting up Roo
  • Getting help and hints from Roo
  • Creating a Roo project
  • Importing a Roo project into Eclipse or IntelliJ IDEA IDE
  • Configuring logging
  • Viewing properties defined in a properties file
  • Managing properties defined in a properties file
  • Creating a Java class
  • Adding attributes to a Java class
  • Creating a Java interface
  • Referring to a type from the Roo shell
  • Creating application artifacts from Roo script

Introduction

Java provides an excellent platform for enterprise application development but has often been weighed down by productivity issues. For instance, if you want to develop a web application, then you need to learn a web framework, create JSPs or views, implement service layer, integrate services with a persistence framework, implement persistence logic, create configuration files for different application layers, write unit and integration tests, write build scripts, and so on. Phew! It seems like a lot of work to even create a simple web application that uses a standard set of Java frameworks. This is the reason why many organizations moved to platforms, which offer quick-start to developing simple or medium complexity applications. With the arrival of open source frameworks like Spring and Hibernate, Java platform received a big boost in terms of developer productivity and simplicity; it was still off the mark when it came to productivity levels compared to platforms like Ruby on Rails, until Spring Roo arrived.

Spring Roo is the next generation rapid application development tool for Java programming language. It is an open source tool, which comes under the umbrella of SpringSource (http://www.springsource.org/) projects. Applications developed using Spring Roo make use of the Spring programming model, which already has a proven track record of delivering portable, testable, and maintainable enterprise applications.

Spring Roo is an easy-to-use tool for rapidly developing Java enterprise applications using well-recognized frameworks such as Spring, Hibernate, AspectJ, Spring Web Flow, Spring Security, GWT, Flex, and so on. Spring Roo takes care of creating project structure for your enterprise application, adding support to use Maven for building and deploying the application, creating application architecture based on your choice of technologies, creating unit and integration tests based on your choice of testing framework, and so on. Spring Roo provides an interactive, intuitive, text-based interface through which you enter the details of your application in a step-by-step fashion to create a working application in minutes.

Note

When using Spring Roo, it's up to the enterprise application developer to choose the technology or framework to use in developing the application. For instance, you can choose Hibernate or OpenJPA for persistence and Spring Web Flow or GWT for the web layer.

So, what do you need to learn to develop applications using Spring Roo? As we will see shortly, you need to learn hardly anything to develop enterprise applications using Spring Roo. Spring Roo's key goal has been to utilize existing knowledge of enterprise developers and automate most of the tasks that a developer had to perform in a typical enterprise application development project. This results in increased developer productivity with nearly no learning curve. Isn't it exciting that you can rapidly develop Java enterprise applications using standard Java technologies without learning anything new?

Before we jump into using Spring Roo tool, let's have a look at the key benefits of using Spring Roo:

  • Improved enterprise developer's productivity: Spring Roo improves enterprise developer's productivity by auto-generating code based on instructions provided by developer or inferred from the code already generated by Spring Roo.
  • Productivity improvement throughout project lifecycle: Spring Roo not only gets you quickly started with the project but it also gives you productivity improvements over the lifetime of the project.
  • No extra layers of abstraction: Spring Roo doesn't attempt to hide implementation details from enterprise developers, making it easy for developers to understand the code and modify it as per their need.
  • No runtime dependency: If you develop applications using Spring Roo, at runtime your application code is only dependent on frameworks that you used for developing the application, nothing more, nothing less.
  • No vendor lock-in: At any time you decide to move away from using Spring Roo, you can use Eclipse IDE or STS (Spring Tool Suite—SourceSource's Eclipse flavor) to remove Spring Roo specific details from your application.

The following figures shows what you can do with Spring Roo and the benefits that you get:

Introduction

The given figure shows that you can also use Spring Roo for creating proof of concepts, for creating prototypes, and for learning new technologies. With Spring Roo you can quickly create a working application in minutes, which makes it an ideal candidate for developing prototypes and creating proof of concepts. A developer can use Spring Roo to create a simple application using the technology that (s)he wants to learn and play around with it or go through the Roo-generated source code to quickly learn about the technology.

In this chapter, we will look at recipes that will help you get started with using Spring Roo for developing your enterprise application. The recipes in this chapter focus on demonstrating how you set up Roo, create a Roo project, create some of the project artifacts, get help and hints on various Roo commands from the Roo shell, and import Roo project in your favorite IDE. This chapter will set the stage for more advanced recipes that we will see in the later chapters of this book.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.9.169