Chapter 2. Wiring beans

 

This chapter covers

  • Declaring beans
  • Injecting constructors and setters
  • Wiring beans
  • Controlling bean creation and destruction

Have you ever stuck around long enough after a movie to watch the credits? It’s incredible how many different people it takes to pull together a major motion picture. In addition to the obvious participants—the actors, scriptwriters, directors, and producers—there are the not-so-obvious—the musicians, special effects crew, and art directors. And that’s not to mention the key grip, sound mixer, costumers, makeup artists, stunt coordinators, publicists, first assistant to the cameraperson, second assistant to the cameraperson, set designers, gaffer, and (perhaps most important) caterers.

Now imagine what your favorite movie would’ve been like had none of these people talked to one another. Let’s say that they all showed up at the studio and started doing their own thing without any coordination of any kind. If the director keeps to himself and doesn’t say “Roll’em,” then the cameraperson wouldn’t start shooting. It probably wouldn’t matter anyway, because the lead actress would still be in her trailer and the lighting wouldn’t work because the gaffer wouldn’t have been hired. Maybe you’ve seen a movie where it looks like this is what happened. But most movies (the good ones, anyway) are the product of thousands of people working together toward the common goal of making a blockbuster film.

2.1. Exploring Spring’s configuration options

2.2. Automatically wiring beans

2.3. Wiring beans with Java

2.4. Wiring beans with XML

2.5. Importing and mixing configurations

2.6. Summary

sitemap