img
Figure 2-3. Spring sample applications
The Petclinic Application
Petclinic (under the folder petclinic) is an interesting sample application that was built to showcase
Spring's data access support. In it, you find a web-based application for querying and updating the
database of a fictional veterinary office. The interesting thing about this application is that it comes with
a selection of interchangeable DAO implementations that highlight how easy it is to decouple your
application from the data access logic when you are using Spring.
The Hibernate DAO implementation really shows off Spring's Hibernate support by implementing
each of the eight DAO methods with a single line or two. The JDBC implementation is equally as
interesting. First, it showcases the use of SimpleJdbcTemplate and SimpleJdbcInsert to eliminate the needs
of redundant code for common JDBC operations. On the other hand, it is very interesting to see how data
access is handled in a much more object-oriented way. By using the RowMapper interface and its various
implementations, the query result set can be directly mapped into value objects and returned to the caller.
This project also contains a very solid example of how to build a web application using Spring's
MVC support, so if you are planning to use Spring MVC for one of your own applications, make sure you
take a look at this sample first.
We cover JDBC support in Chapter 8, Hibernate in Chapter 9, and Spring MVC in Chapter 17.
The Petclinic Groovy Application
The Petclinic Groovy sample (under the folder petclinic-groovy) showcases the implementation of the
same Petclinic application using Groovy and Grails. Groovy is a dynamic scripting language that runs on
JVM, and Grails is a rapid development framework that enables the development of Groovy-based web
applications. The controllers in the Spring MVC layer were all developed in the Groovy language.
A discussion of Grails is out of scope in this topic, but the integration of Spring and Groovy will
be covered in Chapter 22.
Search WWH :
Custom Search
Previous Page
Spring Framework 3 Topic Index
Next Page
Spring Framework 3 Bookmarks
Home