salut
j'ai 1 classe avec 2 constructeurs et 2 attributs
1 avec un paramètre de type string
1 avec un paramètre de type long
dans un bean, je tente d'initialiser un attribut à l'aide d'un des deux constructeur je fais donc
1 2 3 4
|
<bean id="userid" class="tmp.NumId">
<constructor-arg type="java.lang.String" value="4"/>
</bean> |
voici ma classe
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
public class NumId{
private String stringVal=null;
private long longVal=-1
public NumId(String val){
stringVal = val;
}
public NumId(long val){
longVal = val;
}
} |
Spring retourne l'erreur ci-dessss
1 2 3 4 5
|
Initialization of bean failed; nested exception is
org.springframework.beans.TypeMismatchException:
Failed to convert property value of type [java.lang.String] to required
type [tmp.NumId] |
une idée?
Partager