如果属性为非字符串类型的时候需要在配置文件中指定属性的类型,因为默认是按照字符串进行赋值操作;
如果给多个属性进行赋值的时候最好在配置文件中指定属性的index,type等信息
如果给多个属性进行赋值的时候最好在配置文件中指定属性的index,type等信息
java
public class User{
privateString usercode;
publicUser(String usercode) {
this.usercode=usercode;
}
}
applicationContext.xml
<bean id="userAction"class="com.lsz.spring.action.User">
<constructor-argvalue constructor-argvalue="admin" type="String" index ="1"></constructor-arg>
</bean>
原创文章,作者:Maggie-Hunter,如若转载,请注明出处:https://blog.ytso.com/tech/pnotes/8012.html