The following factors should be taken into account for the two IOC injection methods (attribute value injection and constructor injection:
1. Using property value injection makes it easy to process default values and any values. In this case, you do not have to set each property value. constructor injection can easily generate multiple constructor and call each other. multiple constructors or parameters make the program lengthy and difficult to manage.
2. Using property value injection (the property value is not private) will automatically inherit the subclass, but gouzaohanshu cannot. the latter restriction allows the subclass to create only one template function related to the parent class, and it will call the parent class constructor. however, no matter which method is used, most ides now generate constructors or attributes easily.
3. Using property value injection to generate Java documents is easier than constructor injection.
4. In the runtime environment, attribute value injection can use reflection to operate attributes using attribute names. however, for Constructor injection, the compiled class file does not maintain the parameter space of the constructor. Therefore, it is impossible to automatically call the object based on name matching.
5. Property Value injection allows you to obtain and set attribute states (values). This situation is beneficial to many situations, such as the persistence of attribute states to any storage media.
6. Property Value injection can use the propertyeditor mechanism to automatically convert data types as needed. Spring supports this situation.
7. Property Value injection is easy to change because the setter method can be called multiple times.
......................... The translation is too bad. forget it !.......