Bean常用的属性介绍
?
<bean? name=“xxx“ class=“指定的bean类“ scope=“singleton“></bean>
<property name="xxx" value="hello,你好"></property>
<property name="xxx" ref="xxx"/>
????? <constructor-arg type="java.lang.String" value="hp电脑"/>
????? <constructor-arg index="0"? value="hp电脑"/>
10、Constructor-arg:使构造方法注入,指定构造方法的参数。
注:相应的bean中必须含有制定使用的构造器,否则会出现异常
Index属性:设置参数的序号,注:索引从0开始
Type属性:参数类型
Value属性:参数的值。
3、singleton:只有一个共享的实例存在