Book Image

Spring Roo 1.1 Cookbook

Book Image

Spring Roo 1.1 Cookbook

Overview of this book

Spring Roo is an easy-to-use productivity tool for rapidly developing Java enterprise applications using well-recognized frameworks such as Spring, Hibernate, AspectJ, Spring Web Flow, Spring Security, GWT, and so on. Spring Roo takes care of creating maven-enabled projects, enterprise application architecture based on your choice of technologies, unit/integration tests based on your choice of testing framework, and so on. The bottom line is that if you're using Spring, then you must consider using Spring Roo for increased productivity. Spring Roo 1.1 Cookbook brings together a collection of recipes that demonstrate how the Spring Roo developer tool simplifies rapidly developing enterprise applications using standard technologies/frameworks such as JPA, GWT, Spring, Flex, Spring Web Flow, Spring Security, and so on. It introduces readers to developing enterprise applications for the real world using Spring Roo tool. The book starts off with basic recipes to make readers comfortable with using Spring Roo tool. As the book progresses, readers are introduced to more sophisticated features supported by Spring Roo in the context of a Flight Booking application. In a step-by-step by fashion, each recipe shows how a particular activity is performed, what Spring Roo does when a command is executed, and why it is important in the context of the application being developed. Initially, you make a quick start with using Spring Roo through some simple recipes. Then you learn how Spring Roo simplifies creating the persistence layer of an enterprise application using JPA. You are introduced to the various roo commands to create JPA entities, create relationships between JPA entities, create integration tests using Spring TestContext framework, and so on. Following this, the book shows you how Spring Roo simplifies creating the web layer of an enterprise application using Spring Web MVC, Spring Web Flow, and how to create selenium tests for controller objects. Subsequently, we focus on using Spring-BlazeDS, GWT, JSON, and so on. Spring Roo commands that are used to incorporate e-mail/messaging features into an enterprise application are demonstrated next. Finally, we wrap it up with some miscellaneous recipes that show how to extend Spring Roo via add-ons, incorporate security, create cloud-ready applications, remove Spring Roo from your enterprise application, and so on.
Table of Contents (14 chapters)
Spring Roo 1.1 Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Preface

Spring Roo is an easy-to-use productivity tool for rapidly developing Java enterprise applications using well-recognized frameworks such as Spring, Hibernate, AspectJ, Spring Web Flow, Spring Security, GWT, and so on. Spring Roo takes care of creating Maven-enabled projects, enterprise application architecture based on your choice of technologies, unit and / or integration tests based on your choice of testing framework, and so on. The bottom line is that if you're using Spring, then you should consider using Spring Roo for increased productivity

Spring Roo 1.1 Cookbook brings together a collection of recipes that demonstrate how the Spring Roo developer tool simplifies rapidly developing enterprise applications using standard technologies and / or frameworks such as JPA, GWT, Spring, Flex, Spring Web Flow, Spring Security, and so on. It introduces readers to developing enterprise applications for the real world using Spring Roo tool. The book starts off with basic recipes to make readers comfortable with using Spring Roo tool. As the book progresses, readers are introduced to more sophisticated features supported by Spring Roo in the context of a Flight Booking application. In a step-by-step by fashion, each recipe shows how a particular activity is performed, what Spring Roo does when a command is executed, and why it is important in the context of the application being developed.

Initially, you make a quick start using Spring Roo through some simple recipes. Then you learn how Spring Roo simplifies creating the persistence layer of an enterprise application using JPA. You are introduced to the various Roo commands to create JPA entities, create relationships between JPA entities, create integration tests using Spring TestContext framework, and so on. Following this, the book shows you how Spring Roo simplifies creating the web layer of an enterprise application using Spring Web MVC, Spring Web Flow, and how to create Selenium tests for controller objects.

Subsequently, we focus on using Spring-BlazeDS, GWT, JSON, and so on. Spring Roo commands that are used to incorporate e-mail and / or messaging features into an enterprise application are demonstrated next. Finally, we wrap it up with some miscellaneous recipes that show how to extend Spring Roo via add-ons, incorporate security, create cloud-ready applications, remove Spring Roo from your enterprise application, and so on.

A fast-paced guide that helps you effectively use Spring Roo for developing enterprise applications.

What this book covers

Chapter 1, Getting Started with Spring Roo, covers simple recipes to introduce readers to the Spring Roo tool. You will learn how to use some of the basic features of Spring Roo that makes it an easy-to-use productivity tool.

Chapter 2, Persisting Objects Using JPA, covers Spring Roo commands for setting up a JPA provider, creating JPA entities, and creating unit and integration tests.

Chapter 3, Advanced JPA Support in Spring Roo, focuses on Spring Roo commands for adding dynamic finder methods to JPA entities, creating relationship between entities, and creating JPA entities using database reverse engineering support in Spring Roo.

Chapter 4, Web Application Development with Spring Web MVC, covers Spring Web MVC support in Spring Roo. The recipes in this chapter show how to scaffold a Spring Web MVC application from JPA entities, internationalize the web application, and add different themes to it.

Chapter 5, Web Application Development with GWT, Flex, and Spring Web Flow, shows how Spring Roo can be used to scaffold GWT and Flex applications from JPA entities. This chapter also shows how Spring Roo let's you quickly get started with developing applications using Spring Web Flow.

Chapter 6, Emailing, Messaging, Spring Security, Solr, and GAE, covers a multitude of topics related to adding emailing support, messaging using JavaMail API, incorporating application security using Spring Security, adding search capability using Solr search server, and developing applications for Google App Engine (GAE).

Chapter 7, Developing Add-ons and Removing Roo from Projects, wraps up the book with some advanced topics such as how to create Spring Roo add-ons, install an add-on, remove Roo from your project using push-in refactoring, adding Roo support to an existing project using pull-up refactoring, and upgrading to a newer version of Spring Roo.

What you need for this book

  • Spring Roo 1.1.3 or 1.1.4 or 1.1.5

  • Eclipse Helios IDE (or later) or STS

  • Maven 3.x

  • Java SE 6 or later

  • MySQL database

  • Google Plugin for Eclipse IDE

  • Solr server

  • GnuPG

  • H2 database

Who this book is for

Spring Roo 1.1 Cookbook is for developers new to the Spring Roo tool but with experience in developing applications using Spring framework, AspectJ, JPA, GWT, and technologies/frameworks supported by Spring Roo. If you are new to the Spring framework, then it is recommended to refer to a text covering Spring, before reading this Cookbook.

Conventions

In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning

Code words in text are shown as follows:

The perform eclipse and perform command commands are processed by Maven add-on of Spring Roo.

A block of code is set as follows:

<filter>
   <filter-name>HttpMethodFilter</filter-name>
   <filter-class>org.springframework.web.filter.
      HiddenHttpMethodFilter
   </filter-class>
</filter>

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold shown as follows:

<mvc:annotation-driven
      conversion-service ="myConversionService" />
	  
<bean id="myConversionService" class= "..format.
FactoryConversionServiceFactoryBean">
   <property name="converters">
      <list>
         <bean class="com.flight.myCustomConverter"/>
      </list>
   </property>
</bean>

Any command-line input or output is written as follows:

roo> logging setup --level DEBUG --package ROOT
Updated SRC_MAIN_RESOURCES\log4j.properties

New terms and important words are shown in bold. Words that you see on the screen, in menus, or dialog boxes for example, appear in the text like this: "Create a new Flight Description by selecting the Create new Flight Description option from the menu and entering values for Origin, Destination, and Price fields".

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to , and mention the book title via the subject of your message.

If there is a book that you need and would like to see us publish, please send us a note in the SUGGEST A TITLE form on www.packtpub.com or e-mail .

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/support, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.