Tom
Tom

Reputation: 363

Spring bean several parameters setter

How to invoke 2 parameters setter in spring bean? I know that's work with constructor, but imagine that I have method void setMyFoo(int i, boolean b);.

How can I call it from xml?

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

Upvotes: 1

Views: 1175

Answers (2)

dReAmEr
dReAmEr

Reputation: 7196

According to java bean convention,a setter with two parameter is not a setter.Setter and getter are related to only one property at a time.

However if you want,your setter to contains multiple vales ,you can use map or list as a properties which further contains other(primitives).

Upvotes: 1

Sotirios Delimanolis
Sotirios Delimanolis

Reputation: 279990

You can't. Properties are expected to have a corresponding setter method with a single parameter.

Upvotes: 1

Related Questions