Reputation: 15331
I have two constructors:
ctor(String a, String b, char[] c)
ctor(String a, String b, File c)
Now, she I do sth like
<bean id="myBean" class="myClass">
<constructor-arg value="string1" />
<constructor-arg value="string2" />
<constructor-arg value="toCharArray" />
this is resolved using File
constructor by spring... any ideas how to stop this?
Upvotes: 0
Views: 719
Reputation: 10402
You can resolve this in adding the type information to the constructor-arg
element using the type
attribute. See the chapter 4.4.1.1 Constructor-based dependency injection in the Spring documentation for further details.
<bean id="myBean" class="myClass">
<constructor-arg type="java.lang.String" value="string1" />
<constructor-arg type="java.lang.String" value="string2" />
<constructor-arg type="char[]" value="toCharArray" />
</bean>
Upvotes: 4