class SomeoneElsesAPI {
void setDirectory(File dir){...}
void setDirectory(String dir){...}
}
<bean id="someoneElsesAPI" class="com.someone.SomeoneElsesAPI">
<property name="directory">
<value type="java.lang.String">/etc</value>
</property>
</bean>
I have a case similar to the above example, Spring is throwing an IllegalStateException indicating that it can’t convert String to File.
How do I tell spring which of the overloaded methods to use? I thought spring would figure it out when I specified it in the <value type="..."> parameter.
I don’t know if this is a satisfactory answer, but I avoid overloading property setters that I want to be able to wire using IoC. When I do need two setters for (logically) the same property, I use different setter names … and javadoc comments to explain what is going on.