Often the hardest part of coming to grips with any new development tool is knowing where to begin. Typically, this problem is worse when the tool offers as many choices as Spring. Fortunately, getting started with Spring isn't actually that hard if you know where to look first. In this chapter, we present you with all the basic knowledge you need to get off to a flying start. Specifically, we will look at the following:
Obtaining Spring: The first logical step is to obtain or build the Spring JAR files. If you want to get up and running quickly with the standard Spring distribution, simply download the latest Spring distribution from the Spring website at www.springframework.org. However, if you want to be on the cutting edge of Spring developments, check out the latest version of the source code from Spring's CVS repository.
Spring packaging options: Spring packaging is modular; it allows you to pick and choose which components you want to use in your application and to include only those components when you are distributing your application.
Spring dependencies: The full distribution of Spring includes a voluminous set of dependencies, but in many cases, you only need a subset of these dependencies. In this section, we look at which Spring features require which dependencies; this information helps you reduce the size of your application to the absolute minimum.
Spring samples: Spring comes with a large selection of sample applications that make ideal reference points for building your own applications. In this section, we will take a look inside the sample applications to give you a feel for the amount of sample code that is available. If you couple this with the sample application you build during the course of this book, you should have more than enough of a codebase from which to start building your own applications.
Test suite and documentation: One of the things members of the Spring community are most proud of is their comprehensive test suite and documentation set. Testing is a big part of what the team does. By using Clover (www.cenqua.com/clover/index.html), the team actively monitors the percentage test coverage and is constantly striving to push this percentage higher. The documentation set provided with the standard distribution is excellent—we were even lucky enough to have a professional proofreader donate her time to check our atrocious grammar and spelling! This means that the developers can focus on getting down the information that matters, and someone is there to alert them when what they produce doesn't make sense.
Putting a Spring into Hello World: All bad punning aside, we feel that the best way to get started with any new programming tool is to dive right in and write some code. In this section, we are going to look at some simple examples, including a full DI-based implementation of everyone's favorite, Hello World! Don't be alarmed if you don't understand all the code examples right away; full discussions follow later in the book.
If you are already familiar with the basics of the Spring framework, feel free to proceed straight to Chapter 3 for a discussion of the sample application that you will be building during the course of this book. However, even if you are familiar with the basics of Spring, you may find some of the discussions in this chapter interesting, especially those on packaging and dependencies.