The Spring PetClinic Application
Updated :
01-DEC-2004 - Ken Krebs
16-AUG-2003 - Ken Krebs
Introduction
Spring is a collection of small, well-focused, loosely coupled Java
frameworks that can be used independently or collectively to build
industrial strength applications of many different types. The PetClinic
sample application is designed to show how the Spring
application frameworks can be used to build simple, but powerful
database-oriented applications. It will demonstrate the use
of Spring's core functionality:
- JavaBeans based application configuration using
Inversion-Of-Control
- Model-View-Controller web Presentation Layer
- Practical database access through JDBC, Hibernate, or Apache OJB
- Declarative Transaction Management using AOP
- Data Validation that supports but is not dependent on the
Presentation Layer
The Spring frameworks provide a great deal of useful infrastructure to
simplify the tasks faced by application developers. This infrastructure
helps developers to create applications that are :
- concise
by handling a lot of the complex control flow that is needed to use the
Java API's, such as JDBC, JNDI, JTA, RMI, and EJB.
- flexible
by simplifying the process of external application configuration
through
the use of Reflection and JavaBeans. This allows the developer to
achieve a clean separation of configuration data from application code.
All application and web application objects, including validators,
workflow controllers, and views, are JavaBeans that can be configured
externally.
- testable
by supplying an interface based design to maximize pluggability. This
facilitates unit testing of Business Logic without requiring the
presence
of application or live database servers.
- maintainable
by facilitating a clean separation of the application layers. It most
importantly helps maintain the independence of the Business Layer
from the Presentation layer. PetClinic demonstrates the use of a
Model-View-Controller
based web presentation framework that can work seamlessly with many
different types of view technologies. The Spring web application
framework helps developers to implement their Presentation as a clean
and thin layer focused on its main missions of translating user actions
into application events and rendering model data.
It is assumed that users of this tutorial will have a basic knowledge
of object-oriented design, Java, Servlets, JSP, and relational
databases. It also assumes a basic knowledge of the use of a J2EE web
application container.
Since the purpose of the sample application is tutorial in nature, the
implementation presented here will of course provide only a small
subset
of the functionality that would be needed by a real world version of a
PetClinic application.
PetClinic Sample Application Requirements
The application requirement is for an information system that is
accessible through a web browser. The users of the application are
employees of the clinic who in the course of their work need to view
and
manage information regarding the veterinarians, the clients, and their
pets. The sample application supports the following:
Use Cases:
- View a list of veterinarians and their specialties
- View information pertaining to a pet owner
- Update the information pertaining to a pet owner
- Add a new pet owner to the system
- View information pertaining to a pet
- Update the information pertaining to a pet
- Add a new pet to the system
- View information pertaining to a pet's visitation history
- Add information pertaining to a visit to the pet's visitation
history
Business Rules:
- An owner may not have multiple pets with the same
case-insensitive name.