<?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:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">
<bean id="bean1" class="com.bjpowernode.spring.Bean1">
<property name="strValue" value="Hello_Spring"/>
<!--
<property name="intValue" value="123"/>
-->
<property name="intValue">
<value>123</value>
</property>
<property name="listValue"><!-- 注入ArrayList -->
<list>
<value>1</value>
<value>2</value>
</list>
</property>
<property name="setValue"><!-- 注入LinkedHashSet -->
<set>
<value>1.58</value>
<value>66.8</value>
</set>
</property>
<property name="arrayValue">
<list>
<value>array1</value>
<value>array2</value>
</list>
</property>
<property name="mapValue"><!-- 注入LinkedHashMap -->
<map>
<entry key="k1" value="1"/>
<entry key="k2" value="2"/>
</map>
</property>
<property name="dateValue" value="2009-12-14" />
</bean>
</beans>
3.Spring bean常见属性的注入:applicationContext-beans.xml
最新推荐文章于 2024-07-05 13:58:55 发布