Introducing Spring Framework
Introducing Spring Framework Introducing Spring Framework
Chapter 1 Your First Spring Application Most books start with a very long explanation about the technology they are using, the history of it, and often a small example that you can’t run until you reach later chapters. In this book, I am going to take a different approach. I am going to start with some basic examples and I will explain in detail what they do and how to use them so that you get to know Spring quickly. The examples in this chapter will show you how easy it is to integrate the Spring Framework into any existing project or how to start one from scratch and modify it without any effort. Figure 1-1 shows the Spring Framework web site, http://spring.io. In this web site, you can find all of the Spring Extensions, guides, and documentation to help you understand better the Spring ecosystem. Figure 1-1. Spring I/O 3
Chapter 1 ■ Your First Spring Application Pre-Requirements In order to start with the first example you need to have some tools installed. • You need the Java JDK installed and configured. (The JVM must be accessible on the command line, either Windows or Unix). You can install the JDK 1.6 and above. Look for it at this link: www.oracle.com/technetwork/java/javase/downloads/index.html. • Because you are going to use the latest version of Spring Framework, version 4.0.5.RELEASE, you are going to use Gradle to build and run your examples. So far Gradle is one of the best building tools available today that runs using Groovy as a primary language; it is extensible and robust; contains a better library management that can be extended; and is now the preferred way by the Spring core team to build the Spring Framework and its Extensions. If you want to know more about Gradle, take a look at their web site at www.gradle.org (see Figure 1-2). Figure 1-2. Gradle Web Site 4
- Page 1 and 2: THE EXPERT’S VOICE ® IN SPRING
- Page 3 and 4: Contents at a Glance About the Auth
- Page 5 and 6: Introduction This book is an introd
- Page 7: Part I Spring Framework Basics The
- Page 11 and 12: Chapter 1 ■ Your First Spring App
- Page 13 and 14: Chapter 1 ■ Your First Spring App
- Page 15 and 16: Chapter 1 ■ Your First Spring App
- Page 17 and 18: Chapter 1 ■ Your First Spring App
- Page 19 and 20: Chapter 2 ■ Working with Classes
- Page 21 and 22: Chapter 2 ■ Working with Classes
- Page 23 and 24: Chapter 2 ■ Working with Classes
- Page 25 and 26: Chapter 2 ■ Working with Classes
- Page 27 and 28: Chapter 2 ■ Working with Classes
- Page 29 and 30: Chapter 3 Applying Different Config
- Page 31 and 32: Chapter 3 ■ Applying Different Co
- Page 33 and 34: Chapter 3 ■ Applying Different Co
- Page 35 and 36: Chapter 3 ■ Applying Different Co
- Page 37 and 38: Chapter 3 ■ Applying Different Co
- Page 39 and 40: Chapter 3 ■ Applying Different Co
- Page 41 and 42: Spring Stereotypes Chapter 3 ■ Ap
- Page 43 and 44: Chapter 3 ■ Applying Different Co
- Page 45 and 46: Chapter 3 ■ Applying Different Co
- Page 47 and 48: Chapter 3 ■ Applying Different Co
- Page 49 and 50: Chapter 4 ■ Using Beans Scopes pu
- Page 51 and 52: Chapter 4 ■ Using Beans Scopes Th
- Page 53 and 54: Chapter 4 ■ Using Beans Scopes @A
- Page 55 and 56: Chapter 4 ■ Using Beans Scopes do
- Page 57 and 58: Chapter 5 ■ Working with Collecti
Chapter 1 ■ Your First <strong>Spring</strong> Application<br />
Pre-Requirements<br />
In order to start with the first example you need to have some tools installed.<br />
• You need the Java JDK installed and configured. (The JVM must be accessible on the<br />
command line, either Windows or Unix). You can install the JDK 1.6 and above. Look for it at<br />
this link: www.oracle.com/technetwork/java/javase/downloads/index.html.<br />
• Because you are going to use the latest version of <strong>Spring</strong> <strong>Framework</strong>, version 4.0.5.RELEASE,<br />
you are going to use Gradle to build and run your examples. So far Gradle is one of the best<br />
building tools available today that runs using Groovy as a primary language; it is extensible and<br />
robust; contains a better library management that can be extended; and is now the preferred<br />
way by the <strong>Spring</strong> core team to build the <strong>Spring</strong> <strong>Framework</strong> and its Extensions. If you want to<br />
know more about Gradle, take a look at their web site at www.gradle.org (see Figure 1-2).<br />
Figure 1-2. Gradle Web Site<br />
4