Before you can get started with any Spring coding, you need to obtain the Spring code. You have two options for retrieving the code: you can download a packaged distribution from the Spring website, or you can check out the code from the Spring CVS repository.
Spring hosts its development on SourceForge at www.sourceforge.net/projects/springframework. Visit this page to download the latest release of Spring (version 1.1 at the time of writing). If you want to download an older release, click the Files link at the top of the page to view a list of all previous releases.
You will find that each release since 1.0 M4 is available in two flavors: one with all the dependencies included and one without. If you are only going to use a subset of Spring's components, then you might want to download the version without dependencies and then handpick the dependencies that you need using the information in the "Analyzing Spring Dependencies" section later in this chapter. However, bear in mind that you typically use Spring for many projects, and for the sake of an extra few minutes' download time, you can easily have all of the dependencies at hand. Also worth bearing in mind is that the dependencies packaged with Spring were used to compile the distribution, so you can be certain that they are the correct version.
Unless otherwise stated, when we are discussing the sample application, we assume that you have downloaded the full 1.1 distribution including all its dependencies.
Spring is under constant development with many new features, such as JMX integration, already in the pipeline for version 1.2. If you want to get a grip on new features before they make their way into a release, then obtaining the latest codebase from CVS is the best way of going about it.
To check out the latest version of the Spring code, first install CVS, which you can download from www.cvshome.org, and then run the following command:
cvs -d:pserver:firstname.lastname@example.org:/cvsroot/springframework login
When prompted for your password, simply press Enter to send a blank password. Next, enter the following command to check out the HEAD of the CVS repository, which contains the latest changes that have been committed:
cvs -d:pserver:email@example.com:/cvsroot/springframework co spring
This command gives you the absolute latest version of the code, including two separate source trees: one contains the main source for Spring including any new features considered stable enough to be in the main tree; and the other, the sandbox, contains code still classified as work in progress. New code in the main tree is likely to make it into the next release, but code in the sandbox might not. Be aware that any new code is subject to change without notice; for this reason, avoid basing any of your new applications around unreleased code.
Older versions of Spring are stored in CVS tagged by their version number, so you can download any version of Spring directly from CVS. If you are unsure of the tags to use, you can find them by browsing the CVS repository online at http://cvs.sourceforge.net/viewcvs.py/springframework/.