p标签简化xml注入方式
xmlns:p="http://www.springframework.org/schema/p"
即可在bean标签中去掉property标签,直接使用如下方式(对比set注入中的userDao的注入)
<bean id="userDao" class="com.carl.dao.UserDao" p:mapper="15"/>
util标签提取集合注入方式
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="list">
<value>Java课程</value>
<value>Python课程</value>
<value>数据库课程</value>
<value>Scala课程</value>
</util:list>
<bean id="collectionData" class="com.carl.entity.CollectionData">
<property name="course" ref="list"/>
</bean>