|
Level: Intermediate Chad Woolley (thewoolleyman@gmail.com), Software Developer, Ionami 08 Nov 2005 This tutorial introduces you to the Spring framework and the concept of dependency injection (also known as Inversion of Control), in the context of writing a simple Java? Swing GUI application. You will develop a complete, working application from the ground up. You‘ll also get a taste of the Spring Rich Client Project, a new framework for developing Swing applications under Spring. You‘ll come away with an appreciation of Spring‘s versatility and the ways in which it can ease your development tasks. Before you start About this tutorial This tutorial will help you learn the basics of the Spring framework for application development, using Swing, and dependency injection, also known as Inversion of Control (IOC). After a brief overview of Spring and dependency injection, the bulk of the tutorial is hands-on, walking you step-by-step through creating a fully functional Swing application -- a to-do list program -- using Spring. The walk-through includes three options for a build environment, with detailed setup instructions for each one. You‘ll learn the basic use and benefits of the Spring framework in the process. Explanations of other relevant concepts are included along the way. You‘ll also take a few side trips to learn some good programming practices in the context of the tutorial code. The last section is a brief and high-level review of the Spring Rich Client (RCP) framework, a subproject of the Spring framework that‘s working to provide a platform for developing rich-client Swing applications under Spring. The tutorial does not include step-by-step instructions for using the Spring RCP but is a starting point for obtaining the source code and exploring the project on your own. The tutorial shows each new piece of code that you need to type. The complete source code is also available (see Download). The downloadable source code was created by following along and pasting code directly from the tutorial, so it should be bug-free and identical to what you create as you follow along. Because you‘ll write the GUI application in the Java programming language, it will run on any platform that Java code runs on. This tutorial is not intended to be a comprehensive overview of the Spring framework or Swing. It does not cover use of Spring to create Web applications or access databases, or more-advanced topics such as Spring‘s support for aspect-oriented programming (AOP). Explore the tutorial‘s Resources for books, articles, tutorials, and online references that cover Spring and Swing in greater breadth and detail.
Prerequisites The audience for this tutorial is Java developers. It is intended to be accessible to multiple experience levels, and even if you are familiar with one topic you might still learn something about another. Some sections discuss related design patterns and development approaches. Feel free to skim past these if you are uninterested or already familiar with them. The following knowledge and skill levels will be helpful:
You need a computer with a JDK installed (JDK 1.5 is required to run the Rich Client Project demo in the final section) and an Internet connection for downloading the required tools and libraries. One of the following is required, or you can use your own build environment or IDE:
Options for downloading required dependency JARs In order to minimize the amount of up-front downloading work required to start the tutorial, both the Ant and Maven build scripts in the tutorial‘s source code provide support for automatically downloading the required dependency JARs (including Spring itself) from public repositories. This feature is built into Maven, and it is provided in the Ant script by the You can obtain the correct required JAR versions manually if you prefer. Just refer to the |