Java 在Spring中使用idref时出错

Java 在Spring中使用idref时出错,java,spring,dependency-injection,Java,Spring,Dependency Injection,我得到以下错误: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'triangle' defined in class path resource [spring.xml]: Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupporte

我得到以下错误:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'triangle' defined in class path resource [spring.xml]: Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'java.lang.String' to required type 'com.mycompany.springdemo.Point' for property 'point0'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [com.mycompany.springdemo.Point] for property 'point0': no matching editors or conversion strategy found
我的spring配置文件是:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-      beans-2.0.dtd">

<beans>
    <bean id="triangle" class="com.mycompany.springdemo.Triangle">
        <property name="point0">
            <idref bean = "point01"/>
        </property>
        <property name="point1">
            <bean class="com.mycompany.springdemo.Point">
                <property name="x" value="20"/>
                <property name="y" value="0"/>
            </bean>
        </property>
        <property name="point2">
            <bean class="com.mycompany.springdemo.Point">
                <property name="x" value="0"/>
                <property name="y" value="20"/>
           </bean>
        </property>
    </bean>
    <bean id="point01" class="com.mycompany.springdemo.Point">
        <property name="x" value="0"/>
        <property name="y" value="0"/>
    </bean>  

</beans>

如果我使用“ref”初始化point0,那么它可以正常工作,但“idref”会出错。

而不是:

<property name="point0">
            <idref bean = "point01"/>
</property>

使用以下命令:

<property name="point0" ref="point01" />


使用Spring 2的任何原因是否可能重复?如果您试图学习Spring,您可能不应该依赖非常旧的(可能)不受支持的版本