Datasheet
Figure 1-2
Try It Out Compiling Your First Spring Application
The source code for this Spring-wired application can be found in the src\chapter1\springfirst
directory of the code distribution. Follow these steps to compile and run the application using the
Spring container:
Downloading and Installing the Spring Framework
Since Maven 2 downloads dependencies automatically over the Internet, you do not have to download the
Spring framework binaries yourself. If you examine the
pom.xml file in the src\chapter1\springfirst
directory, you can see that Spring is already specified as a dependency there. (See Appendix A for more
information on Maven 2 and
pom.xml.)
To get all the library modules, dependencies, documentations, and sample code, you can always find
the latest version of Spring 2 at
http://www.springframework.org/download. The code in this
book has been tested against the 2.0.6 version of the Spring distribution and should work with all later
versions. When selecting the download files, make sure you pick the
spring-framework-2.x.x-
with-dependencies.zip
file. This is a significantly larger download, but contains the open-source
dependencies that you need. Downloading this file can save you a lot of time downloading dependen-
cies from other locations. To install the framework you need only expand the ZIP file in a directory of
your choice. When creating applications using the framework (and not using Maven to manage your
builds), you may need to include some of the JAR library files in the bundle (for example, a WAR file
for a web application) or refer to them in your build classpath.
CalculateSpring (component)
Component logic
ScreenWriter
(component)
beans.xml
(context
descriptor)
reads
Spring
wires the beans
OpMultiply
(component)
ScreenWriter
(component)
OpAdd
(component)
OpMultiply
(component)
FileWriter
(component)
Operation
interface
ResultWriter
interface
Operation
interface
ResultWriter
interface
ResultWriter
interface
9
Chapter 1: Jump Start Spring 2
01612c01.qxd:WroxPro 10/31/07 10:42 AM Page 9










