Spring Roo in Action
eBook - ePub

Spring Roo in Action

Ken Rimple, Srini Penchikala

Buch teilen
  1. 408 Seiten
  2. English
  3. ePUB (handyfreundlich)
  4. Über iOS und Android verfĂŒgbar
eBook - ePub

Spring Roo in Action

Ken Rimple, Srini Penchikala

Angaben zum Buch
Buchvorschau
Inhaltsverzeichnis
Quellenangaben

Über dieses Buch

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

HĂ€ufig gestellte Fragen

Wie kann ich mein Abo kĂŒndigen?
Gehe einfach zum Kontobereich in den Einstellungen und klicke auf „Abo kĂŒndigen“ – ganz einfach. Nachdem du gekĂŒndigt hast, bleibt deine Mitgliedschaft fĂŒr den verbleibenden Abozeitraum, den du bereits bezahlt hast, aktiv. Mehr Informationen hier.
(Wie) Kann ich BĂŒcher herunterladen?
Derzeit stehen all unsere auf MobilgerĂ€te reagierenden ePub-BĂŒcher zum Download ĂŒber die App zur VerfĂŒgung. Die meisten unserer PDFs stehen ebenfalls zum Download bereit; wir arbeiten daran, auch die ĂŒbrigen PDFs zum Download anzubieten, bei denen dies aktuell noch nicht möglich ist. Weitere Informationen hier.
Welcher Unterschied besteht bei den Preisen zwischen den AboplÀnen?
Mit beiden AboplÀnen erhÀltst du vollen Zugang zur Bibliothek und allen Funktionen von Perlego. Die einzigen Unterschiede bestehen im Preis und dem Abozeitraum: Mit dem Jahresabo sparst du auf 12 Monate gerechnet im Vergleich zum Monatsabo rund 30 %.
Was ist Perlego?
Wir sind ein Online-Abodienst fĂŒr LehrbĂŒcher, bei dem du fĂŒr weniger als den Preis eines einzelnen Buches pro Monat Zugang zu einer ganzen Online-Bibliothek erhĂ€ltst. Mit ĂŒber 1 Million BĂŒchern zu ĂŒber 1.000 verschiedenen Themen haben wir bestimmt alles, was du brauchst! Weitere Informationen hier.
UnterstĂŒtzt Perlego Text-zu-Sprache?
Achte auf das Symbol zum Vorlesen in deinem nÀchsten Buch, um zu sehen, ob du es dir auch anhören kannst. Bei diesem Tool wird dir Text laut vorgelesen, wobei der Text beim Vorlesen auch grafisch hervorgehoben wird. Du kannst das Vorlesen jederzeit anhalten, beschleunigen und verlangsamen. Weitere Informationen hier.
Ist Spring Roo in Action als Online-PDF/ePub verfĂŒgbar?
Ja, du hast Zugang zu Spring Roo in Action von Ken Rimple, Srini Penchikala im PDF- und/oder ePub-Format sowie zu anderen beliebten BĂŒchern aus Informatica & Programmazione in Java. Aus unserem Katalog stehen dir ĂŒber 1 Million BĂŒcher zur VerfĂŒgung.

Information

Verlag
Manning
Jahr
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....

Inhaltsverzeichnis