spring普通属性的注入

spring普通属性的注入:

类名为:bean1

private String strValue;
private Stiing intValue;
private List listValue;
private Set setValue;
private String[] arrayValue;
private Map mapValue;
(将以上的属性进行get,set)

配置文件的配置:

<bean id="bean1" class="com.bjsxt.spring.Bean1">
  <property name="strValue" value="hello"/>

  <property name="intValue">
     <value>123</value>
  </property>


<property name="listValue">
<list>
     <value>list1</value>

     <value>list2</value>
</list>
  </property>


  <property name="setValue">

     <value>set1</value>
     <value>set2</value>

  </property>

  <property name="arrayValue">
<list>
     <value>array1</value>
     <value>array2</value>
</list>
  </property>

  <property name="mapValue">
<map>
     <entry key="k1" value="v1">
     <entry key="k2" value="v2">
</map>
  </property>

</bean>

你可能感兴趣的:(spring)