25.02.2015 Views

Introducing Spring Framework

Introducing Spring Framework

Introducing Spring Framework

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 2 ■ Working with Classes and Dependencies<br />

Figure 2-3. Dependency Injection<br />

Figure 2-3 shows how any implementation of your SearchEngine interface can be injected. Perhaps you are<br />

searching through a database or maybe you’re using a file to retrieve some information. The <strong>Spring</strong> <strong>Framework</strong> also<br />

provides several features such as the following:<br />

• Dependency injection<br />

• Aspect-oriented programming<br />

• Data access<br />

• Transaction management<br />

• Web flow and MVC<br />

• Social frameworks<br />

• Messaging<br />

• Remoting<br />

• Testing<br />

• and more . . .<br />

Right now you do not need to worry about each of these features. Over the course of the book, you are going to<br />

see each one of them in action through your <strong>Spring</strong> application, My Documents.<br />

I was talking about how the <strong>Spring</strong> <strong>Framework</strong> creates instances of your declared beans in the XML file<br />

(Listing 2-7), and how these are ready when you need them or are injected when required. But how does the <strong>Spring</strong><br />

<strong>Framework</strong> know what classes need to be injected? The <strong>Spring</strong> <strong>Framework</strong> has several mechanisms to accomplish<br />

this: by name or by type. The injection can be either using Setters methods or constructors. But you are going to see<br />

this in detail in the following chapters. For now, let’s take a look at Figure 2-4 for an overview of the <strong>Spring</strong> container.<br />

22

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!