Chapter 6. Absolute inversion of control
This chapter covers
Inversion of control (IoC) is a pattern in aspect-oriented programming (AOP) that espouses loose coupling, allowing the application to focus on consuming services rather than locating them. Seam embraces the use of IoC not only to “wire” components together but also to produce context variables and to enable components to communicate with one another through event notifications. Often, when people talk about IoC, they’re really talking about dependency injection (DI), one use of IoC and the primary focus of this chapter.
Dependency injection is a key concept in POJO-based development that keeps components loosely coupled. In the previous chapter, you learned how static DI can be used to establish references from a component instance to its dependent objects during instantiation. In this chapter, you’ll learn about another assembly mechanism in Seam that links a component instance to its dependencies when it’s invoked, a device known as injection. To complement injection, outjection facilitates exporting state from a component instance after the component is invoked, effectively producing context variables that can be used elsewhere in the application.