Spring Roo in Action
eBook - ePub

Spring Roo in Action

Ken Rimple, Srini Penchikala

Condividi libro
  1. 408 pagine
  2. English
  3. ePUB (disponibile sull'app)
  4. Disponibile su iOS e Android
eBook - ePub

Spring Roo in Action

Ken Rimple, Srini Penchikala

Dettagli del libro
Anteprima del libro
Indice dei contenuti
Citazioni

Informazioni sul libro

Summary Spring Roo in Action is a unique book that teaches you how to code Java in Roo, with a particular focus on Spring-based applications. Through hands-on examples, you'll learn how Roo creates well-formed application structures and supports best practices and tools. Plus, you'll get a quick-and-dirty guide to setting up Roo effectively in your environment.
About the Technology
Roo is a lightweight Java console shell that simplifies compile-time tasks. It improves productivity by enforcing correct coding practices and patterns and integrates with mainstream Java technologies, including ActiveMQ, GWT, JPA, and OSGi. And, when you finish coding, it gets out of the way so there's no runtime impact.
About the Book
Spring Roo in Action teaches you to code Java more efficiently using Roo. With the help of many examples, it shows you how to build application components from the database layer to the user interface. The book takes a test-first approach and points out how Roo can help automate many of the mundane details of coding Java apps. Along the way, you'll address important topics like security, messaging, and cloud computing.This book is for Java developers who want to get more productive by using Roo. Purchase of the print book comes with an offer of a free PDF, ePub, and Kindle eBook from Manning. Also available is all code from the book.
What's Inside

  • Learn Roo from the ground up
  • Integrate with existing projects
  • Create custom add-ons
  • Use Roo with Spring


========================================?==============

Table of Contents

PART 1 STARTING SPRING APPS RAPIDLY WITH ROO

  • What is Spring Roo?
  • Getting started with Roo
  • PART 2 DATABASES AND ENTITIES
  • Database persistence with entities
  • Relationships, JPA, and advanced persistence
  • PART 3 WEB DEVELOPMENT
  • Rapid web applications with Roo
  • Advanced web applications
  • RIA and other web frameworks
  • Configuring security
  • PART 4 INTEGRATION
  • Testing your application
  • Enterprise services—email and messaging
  • Roo add-ons
  • Advanced add-ons and deployment
  • PART 5 ROO IN THE CLOUD
  • Cloud computing
  • Workflow applications using Spring Integration

Domande frequenti

Come faccio ad annullare l'abbonamento?
È semplicissimo: basta accedere alla sezione Account nelle Impostazioni e cliccare su "Annulla abbonamento". Dopo la cancellazione, l'abbonamento rimarrà attivo per il periodo rimanente già pagato. Per maggiori informazioni, clicca qui
È possibile scaricare libri? Se sì, come?
Al momento è possibile scaricare tramite l'app tutti i nostri libri ePub mobile-friendly. Anche la maggior parte dei nostri PDF è scaricabile e stiamo lavorando per rendere disponibile quanto prima il download di tutti gli altri file. Per maggiori informazioni, clicca qui
Che differenza c'è tra i piani?
Entrambi i piani ti danno accesso illimitato alla libreria e a tutte le funzionalità di Perlego. Le uniche differenze sono il prezzo e il periodo di abbonamento: con il piano annuale risparmierai circa il 30% rispetto a 12 rate con quello mensile.
Cos'è Perlego?
Perlego è un servizio di abbonamento a testi accademici, che ti permette di accedere a un'intera libreria online a un prezzo inferiore rispetto a quello che pagheresti per acquistare un singolo libro al mese. Con oltre 1 milione di testi suddivisi in più di 1.000 categorie, troverai sicuramente ciò che fa per te! Per maggiori informazioni, clicca qui.
Perlego supporta la sintesi vocale?
Cerca l'icona Sintesi vocale nel prossimo libro che leggerai per verificare se è possibile riprodurre l'audio. Questo strumento permette di leggere il testo a voce alta, evidenziandolo man mano che la lettura procede. Puoi aumentare o diminuire la velocità della sintesi vocale, oppure sospendere la riproduzione. Per maggiori informazioni, clicca qui.
Spring Roo in Action è disponibile online in formato PDF/ePub?
Sì, puoi accedere a Spring Roo in Action di Ken Rimple, Srini Penchikala in formato PDF e/o ePub, così come ad altri libri molto apprezzati nelle sezioni relative a Informatica e Programmazione in Java. Scopri oltre 1 milione di libri disponibili nel nostro catalogo.

Informazioni

Editore
Manning
Anno
2012
ISBN
9781638351580

Part 1. Starting Spring apps rapidly with Roo

Spring Roo is an excellent framework for the rapid development of Spring-based Java applications. With a simple command-line shell, it can create and manage Spring applications, adding and configuring components in all of the application architecture layers from SQL to URL, so to say.
We start exploring Roo with chapter 1, “What is Spring Roo?” explaining how Roo works and how it helps with creating the various configuration files required for a typical Spring application. You’ll also learn how to install and launch the Roo shell. We’ll look at a simple application by running one of the sample scripts provided in the Roo installation package.
Chapter 2, “Getting started with Roo,” will show you how to create applications from scratch with the Roo shell. You’ll also learn the details of Roo project layout and architecture. We discuss one of the new concepts Roo introduces, called AspectJ ITDs that plays an important role in the overall Roo architecture. As developers, you need tools to take advantage of new technologies and frameworks. Roo comes with integration in the form of the SpringSource Tool Suite (STS) IDE tool, which is also discussed in this chapter. We wrap up the chapter with a discussion on refactoring Roo code and leaving Roo behind if, for some reason, you want to remove Roo from your project.

Chapter 1. What is Spring Roo?

This chapter covers
  • The challenges of Enterprise Java
  • The Spring Framework
  • Roo simplifies it all
  • A sample Roo project
You’re about to be introduced to a powerful new tool that makes your life as a Java application developer less stressful and more productive. That tool is Spring Roo. With a simple command-line shell, Roo can create and manage Spring-based applications, adding and configuring features such as the Java Persistence API (JPA), the Java Message Service (JMS), email, and Spring Security. Roo generates Spring MVC web applications. These allow you to manage and edit your database data, configure tests using frameworks such as JUnit and Selenium, and choose from a variety of ORM APIs and databases. At the same time, Roo reduces the amount of code written by you and rolls out efficient, customizable generated code.
In this chapter, we discuss the challenges of working with Enterprise Java applications, create a sample application with the Roo shell, and take a quick tour of Roo’s features. We then review the Roo sample script file and discuss the architectural models available to you when crafting your application.
By the end of this chapter, you’ll see how Roo helps you get rid of much of the tedium Java EE application development demands. You’ll see that you can gain much of the productivity available in dynamic-language, convention-over-configuration platforms such as Ruby on Rails and Grails. This all comes without sacrificing the benefits of Java compile-time type safety, compiled code, and debuggability.
Let’s begin our journey by discussing one of the major reasons why Java-based development projects sputter: the complexity of configuring an application architecture.

1.1. Configuration is a burden

Putting together a Java-based application can be a difficult task these days. Where do you start? There are many things to consider: build scripts, dependency management, architectural patterns, framework selections, database mapping strategies, and much more.
In traditional Enterprise Java development efforts, architects pull together a hodgepodge of open source technologies and standards-driven platforms such as JDBC, the Servlet and JavaServer Pages (JSP) APIs, and Enterprise JavaBeans (EJB) using a build tool such as Ant or Maven. If they’re more advanced, they’ll use an application framework such as Struts and EJB, Seam, or Spring. Many starting templates, IDE shortcuts, and architectural and/or design patterns can be used to make development more efficient, but most of the work involves a lot of coding, physical build configuration, and design work.
Contrast this with your friends programming in dynamic language platforms, such as Ruby on Rails or Grails, who take about 15 minutes to get a basic application shell up and running. That shell usually includes a web application, database data and validation, and some basic business and navigation logic. Unlike a lot of Java application prototypes, theirs is usually the beginning of the final project, whereas Java developers have to try and throw away a fair number of APIs and platforms manually until they get to a point where they’re comfortable assigning a team to the project. The bottom line is that it just takes a long time to write a Java-based application.

1.1.1. Spring reduces the pain

The Spring Framework, a development platform that uses interface-driven development, dependency injection, aspect-oriented programming, and a number of helper APIs and services, significantly reduces the complexity of your Enterprise Java code. If you haven’t heard of Spring by now, we strongly suggest you put this book down and read up on the framework before you dig deeply into Roo. Craig Walls’ excellent Spring in Action is a great companion to this book.
Spring operates on the principle of making your development less about busy work and more about writing business logic. Spring application developers define interface-driven beans that are then implemented as Plain Old Java Objects (POJOs) and mounted in a Spring container using XML, annotations, or Java-based configuration directives.
Here’s an example business interface:
package org.rooinaction.coursemanager.services; ... public interface CourseManager { void addCourse(Course c); List<Course> getAllCourses(); }
Spring developers then create an implementation class:
package org.rooinaction.coursemanager.services; ... public class CourseManagerDefaultImpl { public void addCourse(Course c) { // some logic here } public List<Course> getAllCourses() { // retrieve logic here } }
One way you can use this bean is to autowire it as shown next:
package org.rooinaction.coursemanager.web; ... public class CourseInputComponent { @Autowired private CourseManager courseManager; public void createACourse(String name) { Course c = new Course(); c.setName(name); courseManager.addCourse(c); } }
We’re leaving out the configuration here, but the basic idea is a simple one: let Spring find and mount your component, deal with it at the interface level, and just write a POJO both to expose and use your component.
You can use any Java API you can think of inside a Spring application, but you’re still required to add dependent JAR files and configuration to simplify the programming tasks later.

1.1.2. Shifting from code to configuration

Even Spring can’t save you from all of the tedium involved in building an application. There are many decisions that you need to make, as shown in figure 1.1.
Figure 1....

Indice dei contenuti