You are previewing Spring Recipes, Second Edition.
O'Reilly logo
Spring Recipes, Second Edition

Book Description

With over 3 Million users/developers, Spring Framework is the leading "out of the box" Java framework. Spring addresses and offers simple solutions for most aspects of your Java/Java EE application development, and guides you to use industry best practices to design and implement your applications.

The release of Spring Framework 3 has ushered in many improvements and new features. Spring Recipes: A Problem-Solution Approach, Second Edition continues upon the bestselling success of the previous edition but focuses on the latest Spring 3 features for building enterprise Java applications. This book provides elementary to advanced code recipes to account for the following, found in the new Spring 3:

  • Spring fundamentals: Spring IoC container, Spring AOP/ AspectJ, and more

  • Spring enterprise: Spring Java EE integration, Spring Integration, Spring Batch, jBPM with Spring, Spring Remoting, messaging, transactions, scaling using Terracotta and GridGrain, and more.

  • Spring web: Spring MVC, Spring Web Flow 2, Spring Roo, other dynamic scripting, integration with popular Grails Framework (and Groovy), REST/web services, and more.

This book guides you step by step through topics using complete and real-world code examples. Instead of abstract descriptions on complex concepts, you will find live examples in this book. When you start a new project, you can consider copying the code and configuration files from this book, and then modifying them for your needs. This can save you a great deal of work over creating a project from scratch!

Table of Contents

  1. Copyright
  2. About the Authors
  3. About the Technical Reviewers
  4. Acknowledgments
  5. Introduction
      1. Who This Book Is For
      2. How This Book Is Structured
      3. Conventions
      4. Prerequisites
      5. Downloading the code
      6. Contacting the Authors
  6. 1. Introduction to Spring
    1. 1.1. Instantiating the Spring IoC Container
      1. 1.1.1. Problem
      2. 1.1.2. Solution
      3. 1.1.3. How It Works
        1. 1.1.3.1. Instantiating an Application Context
        2. 1.1.3.2. Getting Beans from the IoC Container
    2. 1.2. Configuring Beans in the Spring IoC Container
      1. 1.2.1. Problem
      2. 1.2.2. Solution
      3. 1.2.3. How It Works
        1. 1.2.3.1. Creating the Bean Class
        2. 1.2.3.2. Creating the Bean Configuration File
        3. 1.2.3.3. Declaring Beans in the Bean Configuration File
        4. 1.2.3.4. Defining Bean Properties by Shortcut
        5. 1.2.3.5. Configuring Collections for Your Beans
        6. 1.2.3.6. Lists, Arrays, and Sets
        7. 1.2.3.7. Maps and Properties
          1. 1.2.3.7.1. Merging the Collection of the Parent Bean
    3. 1.3. Creating Beans by Invoking a Constructor
      1. 1.3.1. Problem
      2. 1.3.2. Solution
      3. 1.3.3. How It Works
    4. 1.4. Resolving Constructor Ambiguity
      1. 1.4.1. Problem
      2. 1.4.2. Solution
      3. 1.4.3. How It Works
    5. 1.5. Specifying Bean References
      1. 1.5.1. Problem
      2. 1.5.2. Solution
      3. 1.5.3. How It Works
        1. 1.5.3.1. Specifying Bean References for Setter Methods
        2. 1.5.3.2. Specifying Bean References for Constructor Arguments
        3. 1.5.3.3. Declaring Inner Beans
    6. 1.6. Specifying the Data Type for Collection Elements
      1. 1.6.1. Problem
      2. 1.6.2. Solution
      3. 1.6.3. How It Works
    7. 1.7. Creating Beans Using Spring's FactoryBean
      1. 1.7.1. Problem
      2. 1.7.2. Solution
      3. 1.7.3. How It Works
    8. 1.8. Defining Collections Using Factory Beans and the Utility Schema
      1. 1.8.1. Problem
      2. 1.8.2. Solution
      3. 1.8.3. How It Works
        1. 1.8.3.1. Specifying the Concrete Class for Collections
        2. 1.8.3.2. Defining Stand-Alone Collections
    9. 1.9. Checking Properties with Dependency Checking
      1. 1.9.1. Problem
      2. 1.9.2. Solution
      3. 1.9.3. How It Works
        1. 1.9.3.1. Checking Properties of the Simple Types
        2. 1.9.3.2. Checking Properties of the Object Types
        3. 1.9.3.3. Checking Properties of All Types
        4. 1.9.3.4. Dependency Checking and Constructor Injection
    10. 1.10. Checking Properties with the @Required Annotation
      1. 1.10.1. Problem
      2. 1.10.2. Solution
      3. 1.10.3. How It Works
    11. 1.11. Auto-Wiring Beans with XML Configuration
      1. 1.11.1. Problem
      2. 1.11.2. Solution
      3. 1.11.3. How It Works
        1. 1.11.3.1. Auto-Wiring by Type
        2. 1.11.3.2. Auto-Wiring by Name
        3. 1.11.3.3. Auto-Wiring by Constructor
        4. 1.11.3.4. Auto-Wiring by Auto-Detection
        5. 1.11.3.5. Auto-Wiring and Dependency Checking
    12. 1.12. Auto-Wiring Beans with @Autowired and @Resource
      1. 1.12.1. Problem
      2. 1.12.2. Solution
      3. 1.12.3. How It Works
        1. 1.12.3.1. Auto-Wiring a Single Bean of Compatible Type
        2. 1.12.3.2. Auto-Wiring All Beans of Compatible Type
        3. 1.12.3.3. Auto-Wiring by Type with Qualifiers
        4. 1.12.3.4. Auto-Wiring by Name
    13. 1.13. Inheriting Bean Configuration
      1. 1.13.1. Problem
      2. 1.13.2. Solution
      3. 1.13.3. How It Works
    14. 1.14. Scanning Components from the Classpath
      1. 1.14.1. Problem
      2. 1.14.2. Solution
      3. 1.14.3. How It Works
        1. 1.14.3.1. Scanning Components Automatically
        2. 1.14.3.2. Filtering Components to Scan
        3. 1.14.3.3. Naming Detected Components
    15. 1.15. Summary
  7. 2. Advanced Spring IoC Container
    1. 2.1. Creating Beans by Invoking a Static Factory Method
      1. 2.1.1. Problem
      2. 2.1.2. Solution
      3. 2.1.3. How It Works
    2. 2.2. Creating Beans by Invoking an Instance Factory Method
      1. 2.2.1. Problem
      2. 2.2.2. Solution
      3. 2.2.3. How It Works
    3. 2.3. Declaring Beans from Static Fields
      1. 2.3.1. Problem
      2. 2.3.2. Solution
      3. 2.3.3. How It Works
    4. 2.4. Declaring Beans from Object Properties
      1. 2.4.1. Problem
      2. 2.4.2. Solution
      3. 2.4.3. How It Works
    5. 2.5. Using the Spring Expression Language
      1. 2.5.1. Problem
      2. 2.5.2. Solution
      3. 2.5.3. How It Works
        1. 2.5.3.1. Features of the Language Syntax
        2. 2.5.3.2. Uses of the Language in Your Configurations
        3. 2.5.3.3. Using the Spring Expression Language Parser
    6. 2.6. Setting Bean Scopes
      1. 2.6.1. Problem
      2. 2.6.2. Solution
      3. 2.6.3. How It Works
    7. 2.7. Customizing Bean Initialization and Destruction
      1. 2.7.1. Problem
      2. 2.7.2. Solution
      3. 2.7.3. How It Works
        1. 2.7.3.1. Implementing the InitializingBean and DisposableBean Interfaces
        2. 2.7.3.2. Setting the init-method and destroy-method Attributes
        3. 2.7.3.3. Annotating the @PostConstruct and @PreDestroy Annotations
    8. 2.8. Reducing XML Configuration with Java Config
      1. 2.8.1. Problem
      2. 2.8.2. Solution
      3. 2.8.3. How It Works
    9. 2.9. Making Beans Aware of the Container
      1. 2.9.1. Problem
      2. 2.9.2. Solution
      3. 2.9.3. How It Works
    10. 2.10. Loading External Resources
      1. 2.10.1. Problem
      2. 2.10.2. Solution
      3. 2.10.3. How It Works
        1. 2.10.3.1. Resource Prefixes
        2. 2.10.3.2. Injecting Resources
    11. 2.11. Creating Bean Post Processors
      1. 2.11.1. Problem
      2. 2.11.2. Solution
      3. 2.11.3. How It Works
    12. 2.12. Externalizing Bean Configurations
      1. 2.12.1. Problem
      2. 2.12.2. Solution
      3. 2.12.3. How It Works
    13. 2.13. Resolving Text Messages
      1. 2.13.1. Problem
      2. 2.13.2. Solution
      3. 2.13.3. How It Works
    14. 2.14. Communicating with Application Events
      1. 2.14.1. Problem
      2. 2.14.2. Solution
      3. 2.14.3. How It Works
        1. 2.14.3.1. Defining Events
        2. 2.14.3.2. Publishing Events
        3. 2.14.3.3. Listening to Events
    15. 2.15. Registering Property Editors in Spring
      1. 2.15.1. Problem
      2. 2.15.2. Solution
      3. 2.15.3. How It Works
    16. 2.16. Creating Custom Property Editors
      1. 2.16.1. Problem
      2. 2.16.2. Solution
      3. 2.16.3. How It Works
    17. 2.17. Concurrency with TaskExecutors
      1. 2.17.1. Problem
      2. 2.17.2. Solution
      3. 2.17.3. How It Works
        1. 2.17.3.1. Java SE
        2. 2.17.3.2. Java EE
        3. 2.17.3.3. Spring's Solution
    18. 2.18. Summary
  8. 3. Spring AOP and AspectJ Support
    1. 3.1. Enabling AspectJ Annotation Support in Spring
      1. 3.1.1. Problem
      2. 3.1.2. Solution
      3. 3.1.3. How It Works
    2. 3.2. Declaring Aspects with AspectJ Annotations
      1. 3.2.1. Problem
      2. 3.2.2. Solution
      3. 3.2.3. How It Works
        1. 3.2.3.1. Before Advices
        2. 3.2.3.2. After Advices
        3. 3.2.3.3. After Returning Advices
        4. 3.2.3.4. After Throwing Advices
        5. 3.2.3.5. Around Advices
    3. 3.3. Accessing the Join Point Information
      1. 3.3.1. Problem
      2. 3.3.2. Solution
      3. 3.3.3. How It Works
    4. 3.4. Specifying Aspect Precedence
      1. 3.4.1. Problem
      2. 3.4.2. Solution
      3. 3.4.3. How It Works
    5. 3.5. Reusing Pointcut Definitions
      1. 3.5.1. Problem
      2. 3.5.2. Solution
      3. 3.5.3. How It Works
    6. 3.6. Writing AspectJ Pointcut Expressions
      1. 3.6.1. Problem
      2. 3.6.2. Solution
      3. 3.6.3. How It Works
        1. 3.6.3.1. Method Signature Patterns
        2. 3.6.3.2. Type Signature Patterns
        3. 3.6.3.3. Bean Name Patterns
        4. 3.6.3.4. Combining Pointcut Expressions
        5. 3.6.3.5. Declaring Pointcut Parameters
    7. 3.7. Introducing Behaviors to Your Beans
      1. 3.7.1. Problem
      2. 3.7.2. Solution
      3. 3.7.3. How It Works
    8. 3.8. Introducing States to Your Beans
      1. 3.8.1. Problem
      2. 3.8.2. Solution
      3. 3.8.3. How It Works
    9. 3.9. Declaring Aspects with XML-Based Configurations
      1. 3.9.1. Problem
      2. 3.9.2. Solution
      3. 3.9.3. How It Works
        1. 3.9.3.1. Declaring Aspects
        2. 3.9.3.2. Declaring Pointcuts
        3. 3.9.3.3. Declaring Advices
        4. 3.9.3.4. Declaring Introductions
    10. 3.10. Load-Time Weaving AspectJ Aspects in Spring
      1. 3.10.1. Problem
      2. 3.10.2. Solution
      3. 3.10.3. How It Works
        1. 3.10.3.1. Load-Time Weaving by the AspectJ Weaver
        2. 3.10.3.2. Load-Time Weaving by Spring Load-Time Weaver
    11. 3.11. Configuring AspectJ Aspects in Spring
      1. 3.11.1. Problem
      2. 3.11.2. Solution
      3. 3.11.3. How It Works
    12. 3.12. Injecting Spring Beans into Domain Objects
      1. 3.12.1. Problem
      2. 3.12.2. Solution
      3. 3.12.3. How It Works
    13. 3.13. Summary
  9. 4. Scripting in Spring
    1. 4.1. Implementing Beans with Scripting Languages
      1. 4.1.1. Problem
      2. 4.1.2. Solution
      3. 4.1.3. How It Works
        1. 4.1.3.1. Scripting Beans with JRuby
        2. 4.1.3.2. Scripting Beans with Groovy
        3. 4.1.3.3. Scripting Beans with BeanShell
    2. 4.2. Injecting Spring Beans into Scripts
      1. 4.2.1. Problem
      2. 4.2.2. Solution
      3. 4.2.3. How It Works
        1. 4.2.3.1. Injecting Spring Beans into JRuby
        2. 4.2.3.2. Injecting Spring Beans into Groovy
        3. 4.2.3.3. Injecting Spring Beans into BeanShell
    3. 4.3. Refreshing Beans from Scripts
      1. 4.3.1. Problem
      2. 4.3.2. Solution
      3. 4.3.3. How It Works
    4. 4.4. Defining Script Sources Inline
      1. 4.4.1. Problem
      2. 4.4.2. Solution
      3. 4.4.3. How It Works
    5. 4.5. Summary
  10. 5. Spring Security
    1. 5.1. Securing URL Access
      1. 5.1.1. Problem
      2. 5.1.2. Solution
      3. 5.1.3. How It Works
        1. 5.1.3.1. Setting Up a Spring MVC Application That Uses Spring Security
        2. 5.1.3.2. Creating the Configuration Files
        3. 5.1.3.3. Creating the Controllers and Page Views
        4. 5.1.3.4. Securing URL Access
    2. 5.2. Logging In to Web Applications
      1. 5.2.1. Problem
      2. 5.2.2. Solution
      3. 5.2.3. How It Works
        1. 5.2.3.1. HTTP Basic Authentication
        2. 5.2.3.2. Form-Based Login
        3. 5.2.3.3. The Logout Service
        4. 5.2.3.4. Anonymous Login
        5. 5.2.3.5. Remember-Me Support
    3. 5.3. Authenticating Users
      1. 5.3.1. Problem
      2. 5.3.2. Solution
      3. 5.3.3. How It Works
        1. 5.3.3.1. Authenticating Users with In-Memory Definitions
        2. 5.3.3.2. Authenticating Users Against a Database
        3. 5.3.3.3. Encrypting Passwords
        4. 5.3.3.4. Authenticating Users Against an LDAP Repository
        5. 5.3.3.5. Caching User Details
    4. 5.4. Making Access Control Decisions
      1. 5.4.1. Problem
      2. 5.4.2. Solution
      3. 5.4.3. How It Works
    5. 5.5. Securing Method Invocations
      1. 5.5.1. Problem
      2. 5.5.2. Solution
      3. 5.5.3. How It Works
        1. 5.5.3.1. Securing Methods by Embedding a Security Interceptor
        2. 5.5.3.2. Securing Methods with Pointcuts
        3. 5.5.3.3. Securing Methods with Annotations
    6. 5.6. Handling Security in Views
      1. 5.6.1. Problem
      2. 5.6.2. Solution
      3. 5.6.3. How It Works
        1. 5.6.3.1. Displaying Authentication Information
        2. 5.6.3.2. Rendering View Contents Conditionally
    7. 5.7. Handling Domain Object Security
      1. 5.7.1. Problem
      2. 5.7.2. Solution
      3. 5.7.3. How It Works
        1. 5.7.3.1. Setting Up an ACL Service
        2. 5.7.3.2. Maintaining ACLs for Domain Objects
        3. 5.7.3.3. Making Access Control Decisions Based on ACLs
        4. 5.7.3.4. Handling Domain Objects Returned from Methods
    8. 5.8. Summary
  11. 6. Integrating Spring with Other Web Frameworks
    1. 6.1. Accessing Spring in Generic Web Applications
      1. 6.1.1. Problem
      2. 6.1.2. Solution
      3. 6.1.3. How It Works
    2. 6.2. Using Spring in Your Servlets and Filters
      1. 6.2.1. Problem
      2. 6.2.2. Solution
      3. 6.2.3. How It Works
        1. 6.2.3.1.
          1. 6.2.3.1.1. Servlets
          2. 6.2.3.1.2. Filters
    3. 6.3. Integrating Spring with Struts 1.x
      1. 6.3.1. Problem
      2. 6.3.2. Solution
      3. 6.3.3. How It Works
        1. 6.3.3.1. Loading Spring's Application Context into a Struts Application
        2. 6.3.3.2. Accessing Spring's Application Context in Struts Actions
        3. 6.3.3.3. Declaring Struts Actions in Spring's Bean Configuration File
    4. 6.4. Integrating Spring with JSF
      1. 6.4.1. Problem
      2. 6.4.2. Solution
      3. 6.4.3. How It Works
        1. 6.4.3.1. Resolving Spring Beans in JSF
        2. 6.4.3.2. Declaring JSF Managed Beans in Spring's Bean Configuration File
    5. 6.5. Integrating Spring with DWR
      1. 6.5.1. Problem
      2. 6.5.2. Solution
      3. 6.5.3. How It Works
        1. 6.5.3.1. Exposing Spring Beans for Remote Invocation
        2. 6.5.3.2. Configuring DWR in Spring's Bean Configuration File
    6. 6.6. Summary
  12. 7. Spring Web Flow
    1. 7.1. Managing a Simple UI Flow with Spring Web Flow
      1. 7.1.1. Problem
      2. 7.1.2. Solution
      3. 7.1.3. How It Works
        1. 7.1.3.1. Setting Up a Spring MVC Application That Uses Spring Web Flow
        2. 7.1.3.2. Creating the Configuration Files
        3. 7.1.3.3. Creating Web Flow Definitions
        4. 7.1.3.4. Creating the Page Views
    2. 7.2. Modeling Web Flows with Different State Types
      1. 7.2.1. Problem
      2. 7.2.2. Solution
      3. 7.2.3. How It Works
        1. 7.2.3.1. Defining View States
        2. 7.2.3.2. Defining Action States
        3. 7.2.3.3. Defining Decision States
        4. 7.2.3.4. Defining End States
        5. 7.2.3.5. Defining Subflow States
    3. 7.3. Securing Web Flows
      1. 7.3.1. Problem
      2. 7.3.2. Solution
      3. 7.3.3. How It Works
    4. 7.4. Persisting Objects in Web Flows
      1. 7.4.1. Problem
      2. 7.4.2. Solution
      3. 7.4.3. How It Works
        1. 7.4.3.1. Configuring JPA in Spring's Application Context
        2. 7.4.3.2. Setting Up JPA for Spring Web Flow
        3. 7.4.3.3. Using JPA in Web Flows
    5. 7.5. Integrating Spring Web Flow with JSF
      1. 7.5.1. Problem
      2. 7.5.2. Solution
      3. 7.5.3. How It Works
        1. 7.5.3.1. Rendering JSF Views for Spring Web Flow
        2. 7.5.3.2. Actions and ActionListeners
        3. 7.5.3.3. Using the JSF Components of Spring Faces
    6. 7.6. Using RichFaces with Spring Web Flow
      1. 7.6.1. Problem
      2. 7.6.2. Solution
      3. 7.6.3. Approach
        1. 7.6.3.1. Setting Up RichFaces With JSF
    7. 7.7. Summary
  13. 8. Spring @MVC
    1. 8.1. Developing a Simple Web Application with Spring MVC
      1. 8.1.1. Problem
      2. 8.1.2. Solution
      3. 8.1.3. How It Works
        1. 8.1.3.1. Setting up a Spring MVC Application
        2. 8.1.3.2. Creating the Configuration Files
        3. 8.1.3.3. Activating Spring MVC annotation scanning
        4. 8.1.3.4. Creating Spring MVC Controllers
        5. 8.1.3.5. Creating JSP Views
        6. 8.1.3.6. Deploying the Web Application
    2. 8.2. Mapping requests with @RequestMapping
      1. 8.2.1. Problem
      2. 8.2.2. Solution
      3. 8.2.3. How It Works
        1. 8.2.3.1. Mapping requests by method
        2. 8.2.3.2. Mapping requests by class
        3. 8.2.3.3. Mapping requests by HTTP request type
    3. 8.3. Intercepting Requests with Handler Interceptors
      1. 8.3.1. Problem
      2. 8.3.2. Solution
      3. 8.3.3. How It Works
    4. 8.4. Resolving User Locales
      1. 8.4.1. Problem
      2. 8.4.2. Solution
      3. 8.4.3. How It Works
        1. 8.4.3.1. Resolving Locales by an HTTP Request Header
        2. 8.4.3.2. Resolving Locales by a Session Attribute
        3. 8.4.3.3. Resolving Locales by a Cookie
        4. 8.4.3.4. Changing a User's Locale
    5. 8.5. Externalizing Locale-Sensitive Text Messages
      1. 8.5.1. Problem
      2. 8.5.2. Solution
      3. 8.5.3. How It Works
    6. 8.6. Resolving Views by Names
      1. 8.6.1. Problem
      2. 8.6.2. Solution
      3. 8.6.3. How It Works
        1. 8.6.3.1. Resolving Views Based on a template's name and location
        2. 8.6.3.2. Resolving Views from an XML Configuration File
        3. 8.6.3.3. Resolving Views from a Resource Bundle
        4. 8.6.3.4. Resolving Views with Multiple Resolvers
        5. 8.6.3.5. The Redirect Prefix
    7. 8.7. Views and Content Negotiation
      1. 8.7.1. Problem
      2. 8.7.2. Solution
      3. 8.7.3. How It Works
    8. 8.8. Mapping Exceptions to Views
      1. 8.8.1. Problem
      2. 8.8.2. Solution
      3. 8.8.3. How It Works
    9. 8.9. Assigning values in a Controller with @Value
      1. 8.9.1. Problem
      2. 8.9.2. Solution
      3. 8.9.3. How It Works
    10. 8.10. Handling Forms with Controllers
      1. 8.10.1. Problem
      2. 8.10.2. Solution
      3. 8.10.3. How It Works
        1. 8.10.3.1. Creating a form's views
        2. 8.10.3.2. Creating a form's service processing
        3. 8.10.3.3. Creating a form's controller
        4. 8.10.3.4. Initializing a model attribute object and pre-populating a form with values
        5. 8.10.3.5. Providing form Reference Data
        6. 8.10.3.6. Binding Properties of Custom Types
        7. 8.10.3.7. Validating Form Data
        8. 8.10.3.8. Expiring a controller's Session Data
    11. 8.11. Handling Multipage Forms with Wizard Form Controllers
      1. 8.11.1. Problem
      2. 8.11.2. Solution
      3. 8.11.3. How It Works
        1. 8.11.3.1. Creating Wizard Form Pages
        2. 8.11.3.2. Creating a Wizard Form Controller
        3. 8.11.3.3. Validating Wizard Form Data
    12. 8.12. Bean validation with Annotations (JSR-303)
      1. 8.12.1. Problem
      2. 8.12.2. Solution
      3. 8.12.3. How It Works
    13. 8.13. Creating Excel and PDF Views
      1. 8.13.1. Problem
      2. 8.13.2. Solution
      3. 8.13.3. How It Works
        1. 8.13.3.1. Creating Excel Views
        2. 8.13.3.2. Creating PDF Views
        3. 8.13.3.3. Creating resolvers for Excel and PDF views
        4. 8.13.3.4. Creating date based PDF and XLS file names
    14. 8.14. Summary
  14. 9. Spring REST
    1. 9.1. Publishing a REST Service with Spring
      1. 9.1.1. Problem
      2. 9.1.2. Solution
      3. 9.1.3. How It Works
    2. 9.2. Accessing a REST Service with Spring
      1. 9.2.1. Problem
      2. 9.2.2. Solution
      3. 9.2.3. How It Works
    3. 9.3. Publishing RSS and Atom feeds
      1. 9.3.1. Problem
      2. 9.3.2. Solution
      3. 9.3.3. How It Works
    4. 9.4. Publishing JSON with REST services
      1. 9.4.1. Problem
      2. 9.4.2. Solution
      3. 9.4.3. How It Works
    5. 9.5. Accessing REST Services with Elaborate XML Responses
      1. 9.5.1. Problem
      2. 9.5.2. Solution
      3. 9.5.3. How It Works
    6. 9.6. Summary
  15. 10. Spring and Flex
    1. 10.1. Getting started with Flex
      1. 10.1.1. Problem
      2. 10.1.2. Solution
      3. 10.1.3. How It Works
        1. 10.1.3.1. Flex Development Basics
        2. 10.1.3.2. The Tools
    2. 10.2. Leaving the Sandbox
      1. 10.2.1. Problem
      2. 10.2.2. Solution
      3. 10.2.3. How It Works
        1. 10.2.3.1. FlashVars
        2. 10.2.3.2. ExternalInterface
        3. 10.2.3.3. HTTP and HTTPS
        4. 10.2.3.4. Consuming SOAP Services
        5. 10.2.3.5. Flash Remoting with AMF
    3. 10.3. Adding the Spring BlazeDS support to an application
      1. 10.3.1. Problem
      2. 10.3.2. Solution
      3. 10.3.3. How It Works
        1. 10.3.3.1. Installing the Spring Support
    4. 10.4. Exposing Services Through BlazeDS / Spring
      1. 10.4.1. Problem
      2. 10.4.2. Solution
      3. 10.4.3. How It Works
    5. 10.5. Working With Server-Side Objects
      1. 10.5.1. Problem
      2. 10.5.2. Solution
      3. 10.5.3. How It Works
    6. 10.6. Consuming Message-Oriented Services Using BlazeDS and Spring
      1. 10.6.1. Problem
      2. 10.6.2. Solution
      3. 10.6.3. How It Works
        1. 10.6.3.1. JMS
        2. 10.6.3.2. Spring Integration
        3. 10.6.3.3. BlazeDS
        4. 10.6.3.4. Sending Messages from Flex
    7. 10.7. Bringing Dependency Injection to your ActionScript Client
      1. 10.7.1. Problem
      2. 10.7.2. Solution
      3. 10.7.3. How It Works
    8. 10.8. Summary
  16. 11. Grails
    1. 11.1. Getting and Installing Grails
      1. 11.1.1. Problem
      2. 11.1.2. Solution
      3. 11.1.3. How It Works
    2. 11.2. Creating a Grails Application
      1. 11.2.1. Problem
      2. 11.2.2. Solution
      3. 11.2.3. How It Works
        1. 11.2.3.1. A Grails Application's File and Directory Structure
        2. 11.2.3.2. Running an Application
        3. 11.2.3.3. Creating Your First Grails Application Construct
        4. 11.2.3.4. Exporting a Grails Application to a WAR
    3. 11.3. Grails Plug-Ins
      1. 11.3.1. Problem
      2. 11.3.2. Solution
      3. 11.3.3. How It Works
    4. 11.4. Developing, Producing, and Testing in Grails Environments
      1. 11.4.1. Problem
      2. 11.4.2. Solution
      3. 11.4.3. How It Works
    5. 11.5. Creating an Application's Domain Classes
      1. 11.5.1. Problem
      2. 11.5.2. Solution
      3. 11.5.3. How It Works
    6. 11.6. Generating CRUD Controllers and Views for an Application's Domain Classes
      1. 11.6.1. Problem
      2. 11.6.2. Solution
      3. 11.6.3. How It Works
    7. 11.7. Internationalization (I18n) Message Properties
      1. 11.7.1. Problem
      2. 11.7.2. Solution
      3. 11.7.3. How it works
    8. 11.8. Changing Permanent Storage Systems
      1. 11.8.1. Problem
      2. 11.8.2. Solution
      3. 11.8.3. How It Works
        1. 11.8.3.1. Setting Up an RDBMS Driver
        2. 11.8.3.2. Configuring an RDBMS Instance
    9. 11.9. Logging
      1. 11.9.1. Problem
      2. 11.9.2. Solution
      3. 11.9.3. How It Works
        1. 11.9.3.1. Configuring Custom Appenders and Loggers
        2. 11.9.3.2. Configuring Layouts
    10. 11.10. Running Unit and Integration Tests
      1. 11.10.1. Problem
      2. 11.10.2. Solution
      3. 11.10.3. How It Works
    11. 11.11. Using Custom Layouts and Templates
      1. 11.11.1. Problem
      2. 11.11.2. Solution
      3. 11.11.3. How It Works
    12. 11.12. Using GORM Queries
      1. 11.12.1. Problem
      2. 11.12.2. Solution
      3. 11.12.3. How It Works
    13. 11.13. Creating Custom Tags
      1. 11.13.1. Problem
      2. 11.13.2. Solution
      3. 11.13.3. How It Works
    14. 11.14. Summary
  17. 12. Spring Roo
    1. 12.1. Setting Up the Spring Roo Development Environment
      1. 12.1.1. Problem
      2. 12.1.2. Solution
      3. 12.1.3. How It Works
        1. 12.1.3.1. Maven
        2. 12.1.3.2. SpringSource Tool Suite
        3. 12.1.3.3. Spring Roo
    2. 12.2. Creating Your First Spring Roo Project
      1. 12.2.1. Problem
      2. 12.2.2. Solution
      3. 12.2.3. How It Works
        1. 12.2.3.1. Exploring the Maven Project
        2. 12.2.3.2. Getting Started Using STS
    3. 12.3. Importing an Existing Project into SpringSource Tool Suite
      1. 12.3.1. Problem
      2. 12.3.2. Solution
      3. 12.3.3. How It Works
    4. 12.4. Building A Better Application, Quicker
      1. 12.4.1. Problem
      2. 12.4.2. Solution
      3. 12.4.3. How It Works
        1. 12.4.3.1. Coding the Backend
        2. 12.4.3.2. Coding the Front-end
    5. 12.5. Removing Spring Roo from Your Project
      1. 12.5.1. Problem
      2. 12.5.2. Solution
      3. 12.5.3. How It Works
    6. 12.6. Summary
  18. 13. Spring Testing
    1. 13.1. Creating Tests with JUnit and TestNG
      1. 13.1.1. Problem
      2. 13.1.2. Solution
      3. 13.1.3. How It Works
        1. 13.1.3.1. Testing with JUnit 3
        2. 13.1.3.2. Testing with JUnit 4
        3. 13.1.3.3. Testing with TestNG
    2. 13.2. Creating Unit Tests and Integration Tests
      1. 13.2.1. Problem
      2. 13.2.2. Solution
      3. 13.2.3. How It Works
        1. 13.2.3.1. Creating Unit Tests for Isolated Classes
        2. 13.2.3.2. Creating Unit Tests for Dependent Classes Using Stubs and Mock Objects
        3. 13.2.3.3. Creating Integration Tests
    3. 13.3. Unit Testing Spring MVC Controllers
      1. 13.3.1. Problem
      2. 13.3.2. Solution
      3. 13.3.3. How It Works
    4. 13.4. Managing Application Contexts in Integration Tests
      1. 13.4.1. Problem
      2. 13.4.2. Solution
      3. 13.4.3. How It Works
        1. 13.4.3.1. Accessing the Context with JUnit 3 Legacy Support
        2. 13.4.3.2. Accessing the Context with the TestContext Framework in JUnit 4
        3. 13.4.3.3. Accessing the Context with the TestContext Framework in JUnit 3
        4. 13.4.3.4. Accessing the Context with the TestContext Framework in TestNG
    5. 13.5. Injecting Test Fixtures into Integration Tests
      1. 13.5.1. Problem
      2. 13.5.2. Solution
      3. 13.5.3. How It Works
        1. 13.5.3.1. Injecting Test Fixtures with JUnit 3 Legacy Support
        2. 13.5.3.2. Injecting Test Fixtures with the TestContext Framework in JUnit 4
        3. 13.5.3.3. Injecting Test Fixtures with the TestContext Framework in JUnit 3
        4. 13.5.3.4. Injecting Test Fixtures with the TestContext Framework in TestNG
    6. 13.6. Managing Transactions in Integration Tests
      1. 13.6.1. Problem
      2. 13.6.2. Solution
      3. 13.6.3. How It Works
        1. 13.6.3.1. Managing Transactions with JUnit 3 Legacy Support
        2. 13.6.3.2. Managing Transactions with the TestContext Framework in JUnit 4
        3. 13.6.3.3. Managing Transactions with the TestContext Framework in JUnit 3
        4. 13.6.3.4. Managing Transactions with the TestContext Framework in TestNG
    7. 13.7. Accessing a Database in Integration Tests
      1. 13.7.1. Problem
      2. 13.7.2. Solution
      3. 13.7.3. How It Works
        1. 13.7.3.1. Accessing a Database with JUnit 3 Legacy Support
        2. 13.7.3.2. Accessing a Database with the TestContext Framework
    8. 13.8. Using Spring's Common Testing Annotations
      1. 13.8.1. Problem
      2. 13.8.2. Solution
      3. 13.8.3. How It Works
        1. 13.8.3.1. Using Common Testing Annotations with JUnit 3 Legacy Support
        2. 13.8.3.2. Using Common Testing Annotations with the TestContext Framework
    9. 13.9. Summary
  19. 14. Spring Portlet MVC Framework
    1. 14.1. Developing a Simple Portlet with Spring Portlet MVC
      1. 14.1.1. Problem
      2. 14.1.2. Solution
      3. 14.1.3. How It Works
        1. 14.1.3.1. Setting Up a Portlet Application
        2. 14.1.3.2. Creating the Configuration Files
        3. 14.1.3.3. Creating Portlet Controllers
        4. 14.1.3.4. Resolving View Names into Views
        5. 14.1.3.5. Creating Portlet Views
        6. 14.1.3.6. Deploying the Portlet Application
    2. 14.2. Mapping Portlet Requests to Handlers
      1. 14.2.1. Problem
      2. 14.2.2. Solution
      3. 14.2.3. How It Works
        1. 14.2.3.1. Mapping Requests by the Portlet Mode
        2. 14.2.3.2. Mapping Requests by a Parameter
    3. 14.3. Handling Portlet Forms with Simple Form Controllers
      1. 14.3.1. Problem
      2. 14.3.2. Solution
      3. 14.3.3. How It Works
        1. 14.3.3.1. Creating Form Controllers
        2. 14.3.3.2. Validating Form Data
    4. 14.4. Summary
  20. 15. Data Access
    1. 15.1. Problems with Direct JDBC
      1. 15.1.1. Setting Up the Application Database
      2. 15.1.2. Understanding the Data Access Object Design Pattern
      3. 15.1.3. Implementing the DAO with JDBC
      4. 15.1.4. Configuring a Data Source in Spring
      5. 15.1.5. How It Works
      6. 15.1.6. Running the DAO
      7. 15.1.7. Taking It A Step Further
    2. 15.2. Using a JDBC Template to Update a Database
      1. 15.2.1. Problem
      2. 15.2.2. Solution
      3. 15.2.3. How It Works
        1. 15.2.3.1. Updating a Database with a Statement Creator
        2. 15.2.3.2. Updating a Database with a Statement Setter
        3. 15.2.3.3. Updating a Database with a SQL Statement and Parameter Values
        4. 15.2.3.4. Batch Updating a Database
    3. 15.3. Using a JDBC Template to Query a Database
      1. 15.3.1. Problem
      2. 15.3.2. Solution
      3. 15.3.3. How It Works
        1. 15.3.3.1. Extracting Data with Row Callback Handler
        2. 15.3.3.2. Extracting Data with a Row Mapper
        3. 15.3.3.3. Querying for Multiple Rows
        4. 15.3.3.4. Querying for a Single Value
    4. 15.4. Simplifying JDBC Template Creation
      1. 15.4.1. Problem
      2. 15.4.2. Solution
      3. 15.4.3. How It Works
        1. 15.4.3.1. Injecting a JDBC Template
        2. 15.4.3.2. Extending the JdbcDaoSupport Class
    5. 15.5. Using the Simple JDBC Template with Java 1.5
      1. 15.5.1. Problem
      2. 15.5.2. Solution
      3. 15.5.3. How It Works
        1. 15.5.3.1. Using a Simple JDBC Template to Update a Database
        2. 15.5.3.2. Using a Simple JDBC Template to Query a Database
    6. 15.6. Using Named Parameters in a JDBC Template
      1. 15.6.1. Problem
      2. 15.6.2. Solution
      3. 15.6.3. How It Works
    7. 15.7. Handling Exceptions in the Spring JDBC Framework
      1. 15.7.1. Problem
      2. 15.7.2. Solution
      3. 15.7.3. How It Works
        1. 15.7.3.1. Understanding Exception Handling in the Spring JDBC Framework
        2. 15.7.3.2. Customizing Data Access Exception Handling
    8. 15.8. Problems with Using ORM Frameworks Directly
      1. 15.8.1. Problem
      2. 15.8.2. Solution
      3. 15.8.3. How It Works
      4. 15.8.4. Persisting Objects Using the Hibernate API with Hibernate XML Mappings
      5. 15.8.5. Persisting Objects Using the Hibernate API with JPA Annotations
      6. 15.8.6. Persisting Objects Using JPA with Hibernate as the Engine
    9. 15.9. Configuring ORM Resource Factories in Spring
      1. 15.9.1. Problem
      2. 15.9.2. Solution
      3. 15.9.3. How It Works
        1. 15.9.3.1. Configuring a Hibernate Session Factory in Spring
        2. 15.9.3.2. Configuring a JPA Entity Manager Factory in Spring
    10. 15.10. Persisting Objects with Spring's ORM Templates
      1. 15.10.1. Problem
      2. 15.10.2. Solution
      3. 15.10.3. How It Works
        1. 15.10.3.1. Using a Hibernate Template and a JPA Template
        2. 15.10.3.2. Extending the Hibernate and JPA DAO Support Classes
    11. 15.11. Persisting Objects with Hibernate's Contextual Sessions
      1. 15.11.1. Problem
      2. 15.11.2. Solution
      3. 15.11.3. How It Works
    12. 15.12. Persisting Objects with JPA's Context Injection
      1. 15.12.1. Problem
      2. 15.12.2. Solution
      3. 15.12.3. How It Works
    13. 15.13. Summary
  21. 16. Transaction Management in Spring
    1. 16.1. Problems with Transaction Management
      1. 16.1.1.
        1. 16.1.1.1. Managing Transactions with JDBC Commit and Rollback
    2. 16.2. Choosing a Transaction Manager Implementation
      1. 16.2.1. Problem
      2. 16.2.2. Solution
      3. 16.2.3. How It Works
    3. 16.3. Managing Transactions Programmatically with the Transaction Manager API
      1. 16.3.1. Problem
      2. 16.3.2. Solution
      3. 16.3.3. How It Works
    4. 16.4. Managing Transactions Programmatically with a Transaction Template
      1. 16.4.1. Problem
      2. 16.4.2. Solution
      3. 16.4.3. How It Works
    5. 16.5. Managing Transactions Declaratively with Transaction Advices
      1. 16.5.1. Problem
      2. 16.5.2. Solution
      3. 16.5.3. How It Works
    6. 16.6. Managing Transactions Declaratively with the @Transactional Annotation
      1. 16.6.1. Problem
      2. 16.6.2. Solution
      3. 16.6.3. How It Works
    7. 16.7. Setting the Propagation Transaction Attribute
      1. 16.7.1. Problem
      2. 16.7.2. Solution
      3. 16.7.3. How It Works
        1. 16.7.3.1. The REQUIRED Propagation Behavior
        2. 16.7.3.2. The REQUIRES_NEW Propagation Behavior
        3. 16.7.3.3. Setting the Propagation Attribute in Transaction Advices, Proxies, and APIs
    8. 16.8. Setting the Isolation Transaction Attribute
      1. 16.8.1. Problem
      2. 16.8.2. Solution
      3. 16.8.3. How It Works
        1. 16.8.3.1. The READ_UNCOMMITTED and READ_COMMITTED Isolation Levels
        2. 16.8.3.2. The REPEATABLE_READ Isolation Level
        3. 16.8.3.3. The SERIALIZABLE Isolation Level
        4. 16.8.3.4. Setting the Isolation Level Attribute in Transaction Advices, Proxies, and APIs
    9. 16.9. Setting the Rollback Transaction Attribute
      1. 16.9.1. Problem
      2. 16.9.2. Solution
      3. 16.9.3. How It Works
    10. 16.10. Setting the Timeout and Read-Only Transaction Attributes
      1. 16.10.1. Problem
      2. 16.10.2. Solution
      3. 16.10.3. How It Works
    11. 16.11. Managing Transactions with Load-Time Weaving
      1. 16.11.1. Problem
      2. 16.11.2. Solution
      3. 16.11.3. How It Works
    12. 16.12. Summary
  22. 17. EJB, Spring Remoting, and Web Services
    1. 17.1. Exposing and Invoking Services Through RMI
      1. 17.1.1. Problem
      2. 17.1.2. Solution
      3. 17.1.3. How It Works
        1. 17.1.3.1. Exposing an RMI Service
        2. 17.1.3.2. Invoking an RMI Service
    2. 17.2. Creating EJB 2.x Components with Spring
      1. 17.2.1. Problem
      2. 17.2.2. Solution
      3. 17.2.3. How It Works
        1. 17.2.3.1. Creating EJB 2.x Components Without Spring's Support
        2. 17.2.3.2. Creating EJB 2.x Components with Spring's Support
    3. 17.3. Accessing Legacy EJB 2.x Components in Spring
      1. 17.3.1. Problem
      2. 17.3.2. Solution
      3. 17.3.3. How It Works
        1. 17.3.3.1. Accessing EJB 2.x Components
    4. 17.4. Creating EJB 3.0 Components in Spring
      1. 17.4.1. Problem
      2. 17.4.2. Solution
      3. 17.4.3. How It Works
    5. 17.5. Accessing EJB 3.0 Components in Spring
      1. 17.5.1. Problem
      2. 17.5.2. Solution
      3. 17.5.3. How It Works
        1. 17.5.3.1. Accessing EJB 3.0 Components with Spring's Support
    6. 17.6. Exposing and Invoking Services Through HTTP
      1. 17.6.1. Problem
      2. 17.6.2. Solution
      3. 17.6.3. How It Works
        1. 17.6.3.1. Exposing a Hessian Service
        2. 17.6.3.2. Invoking a Hessian Service
        3. 17.6.3.3. Exposing a Burlap Service
        4. 17.6.3.4. Invoking a Burlap Service
        5. 17.6.3.5. Exposing an HTTP Invoker Service
        6. 17.6.3.6. Invoking an HTTP Invoker Service
    7. 17.7. Choosing a SOAP Web Service Development Approach
      1. 17.7.1. Problem
      2. 17.7.2. Solution
      3. 17.7.3. How It Works
        1. 17.7.3.1. Contract-Last Web Services
        2. 17.7.3.2. Contract-First Web Services
        3. 17.7.3.3. Comparison
    8. 17.8. Exposing and Invoking a Contract-Last SOAP Web Services Using JAX-WS
      1. 17.8.1. Problem
      2. 17.8.2. Solution
      3. 17.8.3. How It Works
        1. 17.8.3.1. Exposing a Web Service Using The JAX-WS Endpoint Support in the JDK
        2. 17.8.3.2. Exposing a Web Service Using CXF
        3. 17.8.3.3. Invoking a Web Service Using CXF
    9. 17.9. Defining the Contract of a Web Service
      1. 17.9.1. Problem
      2. 17.9.2. Solution
      3. 17.9.3. How It Works
        1. 17.9.3.1. Creating Sample XML Messages
        2. 17.9.3.2. Generating an XSD File from Sample XML Messages
        3. 17.9.3.3. Optimizing the Generated XSD File
        4. 17.9.3.4. Previewing the Generated WSDL File
    10. 17.10. Implementing Web Services Using Spring-WS
      1. 17.10.1. Problem
      2. 17.10.2. Solution
      3. 17.10.3. How It Works
        1. 17.10.3.1. Setting Up a Spring-WS Application
        2. 17.10.3.2. Mapping Web Service Requests to Endpoints
        3. 17.10.3.3. Creating Service Endpoints
        4. 17.10.3.4. Publishing the WSDL File
    11. 17.11. Invoking Web Services Using Spring-WS
      1. 17.11.1. Problem
      2. 17.11.2. Solution
      3. 17.11.3. How It Works
    12. 17.12. Developing Web Services with XML Marshalling
      1. 17.12.1. Problem
      2. 17.12.2. Solution
      3. 17.12.3. How It Works
        1. 17.12.3.1. Creating Service Endpoints with XML Marshalling
        2. 17.12.3.2. Invoking Web Services with XML Marshalling
    13. 17.13. Creating Service Endpoints with Annotations
      1. 17.13.1. Problem
      2. 17.13.2. Solution
      3. 17.13.3. How It Works
    14. 17.14. Summary
  23. 18. Spring in the Enterprise
    1. 18.1. Exporting Spring Beans as JMX MBeans
      1. 18.1.1. Problem
      2. 18.1.2. Solution
      3. 18.1.3. How It Works
        1. 18.1.3.1. Registering MBeans Without Spring's Support
        2. 18.1.3.2. Exporting Spring Beans as MBeans
        3. 18.1.3.3. Exposing MBeans for Remote Access
        4. 18.1.3.4. Assembling the Management Interface of MBeans
        5. 18.1.3.5. Auto-Detecting MBeans by Annotations
    2. 18.2. Publishing and Listening to JMX Notifications
      1. 18.2.1. Problem
      2. 18.2.2. Solution
      3. 18.2.3. How It Works
        1. 18.2.3.1. Publishing JMX Notifications
        2. 18.2.3.2. Listening to JMX Notifications
    3. 18.3. Accessing Remote JMX MBeans in Spring
      1. 18.3.1. Problem
      2. 18.3.2. Solution
      3. 18.3.3. How It Works
        1. 18.3.3.1. Accessing Remote MBeans Through an MBean Server Connection
        2. 18.3.3.2. Accessing Remote MBeans Through an MBean Proxy
    4. 18.4. Sending E-mail with Spring's E-mail Support
      1. 18.4.1. Problem
      2. 18.4.2. Solution
      3. 18.4.3. How It Works
        1. 18.4.3.1. Sending E-mail Using the JavaMail API
        2. 18.4.3.2. Sending E-mail with Spring's MailSender
        3. 18.4.3.3. Defining an E-mail Template
        4. 18.4.3.4. Sending MIME Messages
    5. 18.5. Scheduling with Spring's Quartz Support
      1. 18.5.1. Problem
      2. 18.5.2. Solution
      3. 18.5.3. How It Works
        1. 18.5.3.1. Using Quartz Without Spring's Support
        2. 18.5.3.2. Using Quartz with Spring's Support
    6. 18.6. Scheduling With Spring 3.0's Scheduling Namespace
      1. 18.6.1. Problem
      2. 18.6.2. Solution
      3. 18.6.3. How It Works
    7. 18.7. Summary
  24. 19. Messaging
    1. 19.1. Sending and Receiving JMS Messages with Spring
      1. 19.1.1. Problem
      2. 19.1.2. Solution
      3. 19.1.3. How It Works
        1. 19.1.3.1. Sending and Receiving Messages Without Spring's Support
        2. 19.1.3.2. Sending and Receiving Messages with Spring's JMS Template
        3. 19.1.3.3. Sending and Receiving Messages to and from a Default Destination
        4. 19.1.3.4. Extending the JmsGatewaySupport Class
    2. 19.2. Converting JMS Messages
      1. 19.2.1. Problem
      2. 19.2.2. Solution
      3. 19.2.3. Approach
    3. 19.3. Managing JMS Transactions
      1. 19.3.1. Problem
      2. 19.3.2. Approach
      3. 19.3.3. Solution
    4. 19.4. Creating Message-Driven POJOs in Spring
      1. 19.4.1. Problem
      2. 19.4.2. Solution
      3. 19.4.3. How It Works
        1. 19.4.3.1. Listening for JMS Messages with Message Listeners
        2. 19.4.3.2. Listening for JMS Messages with POJOs
        3. 19.4.3.3. Converting JMS Messages
        4. 19.4.3.4. Managing JMS Transactions
        5. 19.4.3.5. Using Spring's JMS Schema
    5. 19.5. Making the Connection
      1. 19.5.1. Problem
      2. 19.5.2. Solution
      3. 19.5.3. How It Works
    6. 19.6. Summary
  25. 20. Spring Integration
    1. 20.1. Integrating One System with Another Using EAI
      1. 20.1.1. Problem
      2. 20.1.2. Solution
      3. 20.1.3. How It Works
        1. 20.1.3.1. Picking an Integration Style
        2. 20.1.3.2. Building on an ESB Solution
    2. 20.2. Integrating Two Systems Using JMS
      1. 20.2.1. Problem
      2. 20.2.2. Solution
      3. 20.2.3. How it Works
        1. 20.2.3.1. Building an Message Driven Pojo (MDP) Using Spring Integration
    3. 20.3. Interrogating Spring Integration Messages for Context Information
      1. 20.3.1. Problem
      2. 20.3.2. Solution
      3. 20.3.3. How it Works
        1. 20.3.3.1. Using MessageHeaders for Fun and Profit
    4. 20.4. Integrating Two Systems Using a File System
      1. 20.4.1. Problem
      2. 20.4.2. Solution
      3. 20.4.3. How It Works
        1. 20.4.3.1. Concerns in Dealing with a File System
    5. 20.5. Transforming a Message from One Type to Another
      1. 20.5.1. Problem
      2. 20.5.2. Solution
      3. 20.5.3. How It Works
        1. 20.5.3.1. Modifying a Message's Payload
        2. 20.5.3.2. Modifying a Message's Headers
    6. 20.6. Error Handling Using Spring Integration
      1. 20.6.1. Problem
      2. 20.6.2. Solution
      3. 20.6.3. How It Works
        1. 20.6.3.1. Routing to Custom Handlers Based on the Type of Exception
        2. 20.6.3.2. Building a Solution with Multiple Error Channels
    7. 20.7. Forking Integration Control: Splitters and Aggregators
      1. 20.7.1. Problem
      2. 20.7.2. Solution
      3. 20.7.3. How it Works
        1. 20.7.3.1. Using a Splitter
        2. 20.7.3.2. Using Aggregators
    8. 20.8. Conditional Routing with Routers
      1. 20.8.1. Problem
      2. 20.8.2. Solution
      3. 20.8.3. How It Works
    9. 20.9. Adapting External Systems to the Bus
      1. 20.9.1. Problem
      2. 20.9.2. Solution
      3. 20.9.3. How It Works
        1. 20.9.3.1. An Inbound Twitter Adapter
        2. 20.9.3.2. Twitter Messages
        3. 20.9.3.3. A Simple MessageSource
        4. 20.9.3.4. An Outbound Twitter Example
    10. 20.10. Staging Events Using Spring Batch
      1. 20.10.1. Problem
      2. 20.10.2. Solution
      3. 20.10.3. How It Works
    11. 20.11. Using Gateways
      1. 20.11.1. Problem
      2. 20.11.2. Solution
      3. 20.11.3. How It Works
        1. 20.11.3.1. SimpleMessagingGateway
        2. 20.11.3.2. Breaking the Interface Dependency
    12. 20.12. Summary
  26. 21. Spring Batch
    1. 21.1. Runtime Metadata Model
    2. 21.2. Setting Up Spring Batch's Infrastructure
      1. 21.2.1. Problem
      2. 21.2.2. Solution
      3. 21.2.3. How It Works
    3. 21.3. Reading and Writing (but No Arithmetic)
      1. 21.3.1. Problem
      2. 21.3.2. Solution
      3. 21.3.3. How It Works
        1. 21.3.3.1. The Job Configuration
        2. 21.3.3.2. Input
        3. 21.3.3.3. Output
    4. 21.4. Writing a Custom ItemWriter and ItemReader
      1. 21.4.1. Problem
      2. 21.4.2. Solution
      3. 21.4.3. How It Works
        1. 21.4.3.1. Writing a Custom ItemReader
        2. 21.4.3.2. Writing a Custom ItemWriter
    5. 21.5. Processing Input Before Writing
      1. 21.5.1. Problem
      2. 21.5.2. Solution
      3. 21.5.3. How It Works
        1. 21.5.3.1. Chaining Processors Together
    6. 21.6. Better Living through Transactions
      1. 21.6.1. Problem
      2. 21.6.2. Solution
      3. 21.6.3. How It Works
        1. 21.6.3.1. Transactions
        2. 21.6.3.2. Rollbacks
    7. 21.7. Retrying
      1. 21.7.1. Problem
      2. 21.7.2. Solution
      3. 21.7.3. How It Works
        1. 21.7.3.1. Configuring a Step
        2. 21.7.3.2. Retry Template
        3. 21.7.3.3. AOP-Based Retries
    8. 21.8. Controlling Step Execution
      1. 21.8.1. Problem
      2. 21.8.2. Solution
      3. 21.8.3. How It Works
        1. 21.8.3.1. Sequential Steps
        2. 21.8.3.2. Concurrency
        3. 21.8.3.3. Conditional Steps with Statuses
        4. 21.8.3.4. Conditional Steps with Decisions
    9. 21.9. Launching a Job
      1. 21.9.1. Problem
      2. 21.9.2. Solution
      3. 21.9.3. How It Works
        1. 21.9.3.1. Launching From a Web Application
        2. 21.9.3.2. Running from the Command Line
        3. 21.9.3.3. Running On A Schedule
    10. 21.10. Parameterizing a Job
      1. 21.10.1. Problem
      2. 21.10.2. Solution
      3. 21.10.3. How It Works
        1. 21.10.3.1. Launching a Job with Parameters
        2. 21.10.3.2. Accessing JobParameters
    11. 21.11. Summary
  27. 22. Spring on the Grid
    1. 22.1. Clustering Object State Using Terracotta
      1. 22.1.1. Problem
      2. 22.1.2. Solution
      3. 22.1.3. How It Works
        1. 22.1.3.1. Deploying a Simple Example with Terracotta
        2. 22.1.3.2. Terracotta Architecture and Deployment
        3. 22.1.3.3. The XML Configuration File
    2. 22.2. Farming Out Execution to a Grid
      1. 22.2.1. Problem
      2. 22.2.2. Solution
      3. 22.2.3. Approach
        1. 22.2.3.1. Deployment
    3. 22.3. Load Balancing a Method
      1. 22.3.1. Problem
      2. 22.3.2. Solution
      3. 22.3.3. Approach
    4. 22.4. Parallelizing Processing
      1. 22.4.1. Problem
      2. 22.4.2. Solution
      3. 22.4.3. Approach
    5. 22.5. Deploying on GridGain
      1. 22.5.1. Problem
      2. 22.5.2. Solution
      3. 22.5.3. How It Works
        1. 22.5.3.1. Creating a Grid Node
        2. 22.5.3.2. Provisioning a Grid Node
        3. 22.5.3.3. Getting Access to the Spring Container from a Task
        4. 22.5.3.4. Node-Specific GridGain Configuration
    6. 22.6. Summary
  28. 23. jBPM and Spring
    1. 23.1. Software Processes
    2. 23.2. Understanding Workflow Models
      1. 23.2.1. Problem
      2. 23.2.2. Solution
      3. 23.2.3. How It Works
    3. 23.3. Installing jBPM
      1. 23.3.1. Problem
      2. 23.3.2. Solution
      3. 23.3.3. How It Works
    4. 23.4. Integrating jBPM 4 with Spring
      1. 23.4.1. Problem
      2. 23.4.2. Solution
      3. 23.4.3. How It Works
        1. 23.4.3.1. The Application Context
    5. 23.5. Building a Service with Spring
      1. 23.5.1. Problem
      2. 23.5.2. Solution
      3. 23.5.3. How It Works
    6. 23.6. Building a Business Process
      1. 23.6.1. Problem
      2. 23.6.2. Solution
      3. 23.6.3. How It Works
    7. 23.7. Summary
  29. 24. OSGi and Spring
    1. 24.1. Getting Started with OSGi
      1. 24.1.1. Problem
      2. 24.1.2. Solution
      3. 24.1.3. How It Works
        1. 24.1.3.1. OSGi and JavaBeans
        2. 24.1.3.2. The helloworld-service Service
        3. 24.1.3.3. Installing Equinox
        4. 24.1.3.4. Using the Service in a Client Bundle
    2. 24.2. Getting Started Using Spring Dynamic Modules
      1. 24.2.1. Problem
      2. 24.2.2. Solution
      3. 24.2.3. How It Works
    3. 24.3. Exporting a Service Using Spring Dynamic Modules
      1. 24.3.1. Problem
      2. 24.3.2. Solution
      3. 24.3.3. How It Works
        1. 24.3.3.1. Interfacing with the OSGi Runtime
    4. 24.4. Finding a Specific Service in the OSGi Registry
      1. 24.4.1. Problem
      2. 24.4.2. Solution
      3. 24.4.3. How It Works
        1. 24.4.3.1. Ranking
        2. 24.4.3.2. Service Attributes
        3. 24.4.3.3. Cardinality
    5. 24.5. Publishing a Service Under Multiple Interfaces
      1. 24.5.1. Problem
      2. 24.5.2. Solution
      3. 24.5.3. How It Works
    6. 24.6. Customizing Spring Dynamic Modules
      1. 24.6.1. Problem
      2. 24.6.2. Solution
      3. 24.6.3. How It Works
        1. 24.6.3.1. Making Spring Process OSGi Annotations on Beans
        2. 24.6.3.2. Changing the Default HTTP Server That Spring Uses When Deploying a .war
    7. 24.7. Using SpringSource dm Server
      1. 24.7.1. Problem
      2. 24.7.2. Solution
      3. 24.7.3. How It Works
    8. 24.8. SpringSource's Tooling
      1. 24.8.1. Problem
      2. 24.8.2. Solution
      3. 24.8.3. How it Works
    9. 24.9. Summary