Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
springbean多参数设置器_Spring_Spring Mvc_Javabeans - Fatal编程技术网

springbean多参数设置器

springbean多参数设置器,spring,spring-mvc,javabeans,Spring,Spring Mvc,Javabeans,如何在Springbean中调用2个参数设置器?我知道这是构造函数的工作,但假设我有方法void setMyFoo(inti,booleanb) 如何从xml中调用它 <property name="MyFoo"> //what should be there ???? </property> //应该有什么???? 你不能。属性应该有一个具有单个参数的对应setter方法。根据JavaBean约定,具有两个参数的setter不是setter。setter和get

如何在Springbean中调用2个参数设置器?我知道这是构造函数的工作,但假设我有方法
void setMyFoo(inti,booleanb)

如何从xml中调用它

<property name="MyFoo">
  //what should be there ????
</property>

//应该有什么????

你不能。属性应该有一个具有单个参数的对应setter方法。

根据JavaBean约定,具有两个参数的setter不是setter。setter和getter一次只与一个属性相关


但是,如果您希望setter包含多个值,您可以使用map或list作为属性,进一步包含其他(原语)。

您能给出一个解决OP问题的示例吗?