chapter three
3 The Spring Context: Wiring beans
This chapter covers
- Establishing relationships among beans
- Using dependency injection
- Accessing the beans from the Spring context through dependency injection
In chapter 2, we discussed the Spring context. The Spring context is the place in the app's memory, where we add the object instances we want Spring to manage. Because Spring uses the inversion of control (IoC) principle, as we discussed in chapter 2, we need to tell Spring which objects of our app it needs to control. Spring needs control over some of the objects of our app to augment them with the capabilities it provides. In chapter 2, you learned multiple ways to add object instances to the Spring context. You also learned that we add these instances (which we call beans) into the Spring context to make Spring aware of them.