The services provided by the container include:
1. lifecycle management
2. Search: Search for references to Managed Objects
3. Configuration: use consistent methods to configure Managed Objects
4. dependency parsing:
There are two IOC policies:
1. Dependency search: a traditional method similar to JNDI
2. Dependency injection: The method using JavaBean property is called setter injection or type 2,
The constructor parameters are called constructor injection or Type 3.
Setter injection: the setter method of Javabean is executed immediately after the object instance is constructed by the container and before any business method is called.
It works well for objects with default values, meaning that all properties are not required during runtime.
The setter order is not expressed in any contract. Not all necessary setters are called before the object is used,
Therefore, the object may only be partially configured. (spring can avoid this through dependency check)
Constructor receives input parameters and assigns values to properties.
Each managed object can be fully configured.
Valuable legacyCodeNot supported, such as commons DBCP.
These references in the object cannot be changed after the collaboration parameters are passed in the constructor and the member variables are initialized.