1. A null value
<property name="address">
 <null/>
</property>

Copy the code
2. Attribute values contain special symbols
 1Escape <>; &gt;2Write special signed content to CDATA <property name="address">
 <value><! [CDATA [< < Nanking > >]] ></value>
</property>
Copy the code
3. Set
 <property name="sets">
 <set>
 <value>MySQL</value>
 <value>Redis</value>
 </set>
 </property>

Copy the code
4. Map
 <property name="maps">
 <map>
 <entry key="JAVA" value="java"></entry>
 <entry key="PHP" value="php"></entry>
 </map>
 </property>
Copy the code
5. List
  • The first kind of
<property name="list">
    <list>
        <value>Zhang SAN</value>
        <value>Small three</value>
    </list>
</property>
Copy the code
  • The second introduces the util namespace
<? xml version="1.0" encoding="UTF-8"? ><beans xmlns="http://www.springframework.org/schema/beans"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xmlns:p="http://www.springframework.org/schema/p"
 xmlns:util="http://www.springframework.org/schema/util"
 xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">
    <util:list id="bookList">
         <value>Yi jin jing</value>
         <value>Nine Yin true through</value>
         <value>Sun alkaloids</value>
    </util:list>
    <bean id="book" class="com.atguigu.spring5.collectiontype.Book">
     <property name="list" ref="bookList"></property>
    </bean>
</beans>
Copy the code
An array of 6.
 <property name="courses">
 <array>
 <value>Java classes</value>
 <value>Database course</value>
 </array>
 </property>

Copy the code
Object of 7.
<bean id="emp" class="com.atguigu.spring5.bean.Emp">
 <property name="ename" value="lucy"></property>
 <property name="gender" value="Female"></property>
 <property name="dept" ref="dept"></property>
</bean>
<bean id="dept" class="com.atguigu.spring5.bean.Dept">
 <property name="dname" value="Finance Department"></property>
</bean>
Copy the code
    <bean id="user" class="com.zcy.www.entity.User" p:name="Late Breeze" p:sex="Male">
        <property name="course">
            <bean id="course" class="com.zcy.www.entity.Course">
                <constructor-arg name="name" value="C"></constructor-arg>
                <constructor-arg name="time" value="24"></constructor-arg>
            </bean>
        </property>
    </bean>
Copy the code
7. Object collection
<bean id="course1" class="com.atguigu.spring5.collectiontype.Course">
 <property name="cname" value="Spring5 framework"></property>
</bean>
<bean id="course2" class="com.atguigu.spring5.collectiontype.Course">
 <property name="cname" value="MyBatis framework"></property>
</bean><! Insert list collection type, value is object --><property name="courseList">
 <list>
 <ref bean="course1"></ref>
 <ref bean="course2"></ref>
 </list>
</property>
Copy the code