Simple Spring property injection and set property Injection
Property injection is an important feature in Spring. The following describes the specific operations of simple property injection and set property injection.
Steps:
① The property tag should be used for both simple property injection and set property injection.
② If it is a simple property injection, you can directly assign a value to the value of the property tag. We can leave the value type unspecified, and the framework will automatically identify it. Of course, we can also specify it, the specified format is java. lang. string (type to be written ). There are also two methods:
Method 1:
Method 2:
Value
③ If the set type is set, in addition to adding the property tag, the corresponding set type tag should also be added to the tag.
As follows:
The preceding method can be used to inject simple attributes and set type attributes.