■NoteThe actual flow displayed here is a slight variation on the use case we will be implementing later in
this chapter.
Because the terminology used within Spring Web Flow is implementation agnostic, flow
definitions provide a valuable source of documentation that is understandable by all parties
involved in the development process, and best of all, it is never out of date.
Best Practices
Drawing from its roots within the Spring community, Spring Web Flow adheres to established
best practices:
•Develop against interfaces to allow you to plug in the most appropriate implementa-
tion. A fine-grained life cycle event listener infrastructure provides further
customization points.
•Favor integration with established technologies over reinventing the wheel. Spring Web
Flow ties into much of the same foundational infrastructure Spring MVC does. This
includes Spring’s BeanFactoryfor configuration, Spring’s Data Binderand Validator
concepts, and Spring MVC’s DispatcherServletand Viewresolution subsystems.
- Allow reusablility from within other established web frameworks, to provide a choice in
product configuration. As an embeddable “page flow engine,” Spring Web Flow integrates
out of the box with Struts, JavaServer Faces ( JSF), and Portlet MVC environments.
•Facilitate test-driven development (TDD) by removing coupling between components,
collaborators, and the deployment environment. Flow executions are easy to test both
in isolation and as part of an end-to-end integration test.
Low Adoption Overhead
Because Spring Web Flow is self-contained, there is little impact when introducing it on exist-
ing projects. There is no requirement or suggestion that Spring Web Flow should be the only
player in the project. It should simply be used when it is appropriate.
Spring Web Flow is another Controllertool in the MVC toolbox. It does not require exclu-
sivity, it does not impose any restrictions on your domain model, and it fits very easily into the
existing Spring MVC architecture. In fact, a major design goal of Spring Web Flow was to do
one thing and do it well.
The final aspect of adoption is modifications to existing code. Because artifacts within
Spring Web Flow are interfaces as opposed to abstract classes, your cost of modifying your
existing artifacts is very low. In all likelihood there would be very little impact on your existing
code base; integration is usually a case of configuring one of the provided Controllerimple-
mentations.
CHAPTER 11 ■INTRODUCTION TO SPRING WEB FLOW 313