在src目录下创建assemble包
在assemble包下创建类ComplexUser

package assemble;

import java.util.List;
import java.util.Map;
import java.util.Set;

public class ComplexUser {
    private String uname;
    private List<String> hobbyList;
    private Map<String, String> residenceMap;
    private Set<String> aliasSet;
    private String[] array;

    /*
     * 使用构造方法注入,需要提供带参数的构造方法
     */
    public ComplexUser(String uname, List<String> hobbyList, Map<String, String> residenceMap, Set<String> aliasSet, String[] array) {
        super();
        this.uname = uname;
        this.hobbyList = hobbyList;
        this.residenceMap = residenceMap;
        this.aliasSet = aliasSet;
        this.array = array;
    }

    /**
     * 使用setter方法注入,提供默认无参数的构造方法,并为注入的属性提供setter方法
     */
    public ComplexUser() {
        super();
    }

    public void setUname(String uname) {
        this.uname = uname;
    }

    public void setHobbyList(List<String> hobbyList) {
        this.hobbyList = hobbyList;
    }

    public void setResidenceMap(Map<String, String> residenceMap) {
        this.residenceMap = residenceMap;
    }

    public void setAliasSet(Set<String> aliasSet) {
        this.aliasSet = aliasSet;
    }

    public void setArray(String[] array) {
        this.array = array;
    }

    @Override
    public String toString() {
        return "uname=" + uname + ";hobbyList=" + hobbyList + ";residenceMap=" + residenceMap + ";aliasSet=" + aliasSet + ";array=" + array;
    }
}

创建spring配置文件applicationContext.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">

    <!-- 使用构造方法注入方式装配 ComplexUser实例user1 -->
    <bean id="user1" class="assemble.ComplexUser">
        <constructor-arg index="0" value="chenheng1"/>
        <constructor-arg index="1">
            <list>
                <value>唱歌</value>
                <value>跳舞</value>
            </list>
        </constructor-arg>
        <constructor-arg index="2">
            <map>
                <entry key="dalian" value="大连"/>
                <entry key="beijing" value="北京"/>
            </map>
        </constructor-arg>
        <constructor-arg index="3">
            <set>
                <value>陈恒100</value>
                <value>陈恒101</value>
            </set>
        </constructor-arg>
        <constructor-arg index="4">
            <array>
                <value>aaaaa</value>
                <value>bbbbb</value>
            </array>
        </constructor-arg>
    </bean>

    <!-- 使用setter方法注入方式装配 ComplexUser实例user2 -->
    <bean id="user2" class="assemble.ComplexUser">
        <property name="uname" value="chenheng2"/>
        <property name="hobbyList">
            <list>
                <value>看书</value>
                <value>学习Spring</value>
            </list>
        </property>
        <property name="residenceMap">
            <map>
                <entry key="shenzhen" value="深圳"/>
                <entry key="gaungzhou" value="广州"/>
            </map>
        </property>
        <property name="aliasSet">
            <set>
                <value>陈恒103</value>
                <value>陈恒104</value>
            </set>
        </property>
        <property name="array">
            <array>
                <value>cccccc</value>
                <value>dddddd</value>
            </array>
        </property>
    </bean>
</beans>

在test包下创建TestAssemble类

package test;

import assemble.ComplexUser;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class TestAssemble {
    public static void main(String[] args) {
        ApplicationContext appCon = new ClassPathXmlApplicationContext("applicationContext.xml");
        //构造方法装配测试
        ComplexUser u1 = (ComplexUser) appCon.getBean("user1");
        System.out.println(u1);
        //setter方法装配测试
        ComplexUser u2 = (ComplexUser) appCon.getBean("user2");
        System.out.println(u2);
    }
}

结果

4月 06, 2019 11:33:10 上午 org.springframework.context.support.ClassPathXmlApplicationContext prepareRefresh
信息: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@5a8e6209: startup date [Sat Apr 06 11:33:10 CST 2019]; root of context hierarchy
4月 06, 2019 11:33:10 上午 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
信息: Loading XML bean definitions from class path resource [applicationContext.xml]
uname=chenheng1;hobbyList=[唱歌, 跳舞];residenceMap={dalian=大连, beijing=北京};aliasSet=[陈恒100, 陈恒101];array=[Ljava.lang.String;@2794eab6
uname=chenheng2;hobbyList=[看书, 学习Spring];residenceMap={shenzhen=深圳, gaungzhou=广州};aliasSet=[陈恒103, 陈恒104];array=[Ljava.lang.String;@6340e5f0