spring 元素用来存储多个键值对属性,类型为Java.util.Map;他的子标签用来定义Map中的键值实体,下面举例说明;
Article.java
这个article class有一个属性是作者联名信息,使用序号和作者名来构成一个Map属性.
import java.util.*;
public class Article
{
private String title;
private Map authorsInfo;
public void setTitle(String title) {
this.title = title;
}
public String getTitle() {
return title;
}
public void setAuthorsInfo(Map authorsInfo) {
this.authorsInfo = authorsInfo;
}
public Map getAuthorsInfo() {
return authorsInfo;
}
}
spring-beans.xml:
元素用于提供具体的实体键值配置,通过将序号和作者名称进行绑定注入。
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springfr