Strictly speaking: A setter with two parameters is not a setter.
It violates the JavaBeans convention, on which Spring builds. There is no simple way to solve that.
As an alternative, here's a Helper class you can use to configure your HttpParams object with Spring:
public class HttpParamSetter{
private HttpParams httpParams;
public void setHttpParams(HttpParams httpParams){
this.httpParams = httpParams;
}
private Map<String, Object> parameters;
public void setParameters(Map<String, Object> parameters){
this.parameters = parameters;
}
@PostConstruct
public void applyParameters(){
for(Entry<String, Object> entry:parameters.entrySet()){
httpParams.setParameter(entry.getKey(), entry.getValue());
}
}
}
Wire it like this:
<bean class="com.yourcompany.HttpParamSetter">
<property name="httpParams" ref="httpParams" />
<property name="parameters">
<map>
<entry key="foo" value="bar" />
<entry key="baz" value="phleem" />
</map>
</property>
</bean>