|
|
|
@ -10,12 +10,11 @@ This chapter covers Spring's Inversion of Control (IoC) container. |
|
|
|
== Introduction to the Spring IoC Container and Beans |
|
|
|
== Introduction to the Spring IoC Container and Beans |
|
|
|
|
|
|
|
|
|
|
|
This chapter covers the Spring Framework implementation of the Inversion of Control |
|
|
|
This chapter covers the Spring Framework implementation of the Inversion of Control |
|
|
|
(IoC) principle. (See <<overview.adoc#background-ioc,Inversion of Control>>.) IoC |
|
|
|
(IoC) principle. IoC is also known as dependency injection (DI). It is a process whereby |
|
|
|
is also known as dependency injection (DI). It is a process whereby objects define |
|
|
|
objects define their dependencies (that is, the other objects they work with) only through |
|
|
|
their dependencies (that is, the other objects they work with) only through constructor |
|
|
|
constructor arguments, arguments to a factory method, or properties that are set on the |
|
|
|
arguments, arguments to a factory method, or properties that are set on the object |
|
|
|
object instance after it is constructed or returned from a factory method. The container |
|
|
|
instance after it is constructed or returned from a factory method. The container then |
|
|
|
then injects those dependencies when it creates the bean. This process is fundamentally |
|
|
|
injects those dependencies when it creates the bean. This process is fundamentally |
|
|
|
|
|
|
|
the inverse (hence the name, Inversion of Control) of the bean itself |
|
|
|
the inverse (hence the name, Inversion of Control) of the bean itself |
|
|
|
controlling the instantiation or location of its dependencies by using direct |
|
|
|
controlling the instantiation or location of its dependencies by using direct |
|
|
|
construction of classes or a mechanism such as the Service Locator pattern. |
|
|
|
construction of classes or a mechanism such as the Service Locator pattern. |
|
|
|
|