Spring Getting Started 10 - Collection Object Injection

xiaoxiao2021-03-06  47

Getting Started 10 - Collection Object Injection

For collections such as array, java.util.list, java.util.set, java.util.map, etc., you must fill in some objects to a collection before the injection, then inject the collection object into the desired Bean. For example, if there is a bean as follows:

Somebean.java

Public class somebean {

PRIVATE STRING [] Somestrarray;

PRIVATE SOMEOBJ [] Someobjarray;

PRIVATE List Somelist;

PRIVATE MAP SOMEMAP;

....

}

For this demand, Spring can also help you maintain, directly to see how the bean definition file is set:

Hello! Justin!

Hello! MoMor!

Hello! Bush!

Hello! Justin!

Hello! Justin!

The above bean definition file is a comprehensive demonstration, and the array is set with the volume, and the Map object uses the volume label setting, and requires a KEY value setting. Use the tag, for example:

a set element

You can also inject java.util.properties, bean definition files to demonstrate as follows: ....

....

SomeProvalue1

SomeProvalue2

....

转载请注明原文地址:https://www.9cbs.com/read-60916.html

New Post(0)