请帮我解决这个问题。我在春天配置了autowire =" autodetect"。我想使用它但出现此错误 " cvc-enumeration-valid:值' autodetect'在枚举' [default,no,byName,byType,constructor]'方面不是facet-valid。它必须是枚举中的值。"
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.2.xsd">
<bean id="circle" class="com.Circle_Constructor" autowire="autodetect" ></bean>
<bean class="com.Point" id="point">
<property name="x" value="0"></property>
<property name="y" value="0"></property>
</bean>
</beans>
答案 0 :(得分:1)
罪魁祸首是:
xsi:schemaLocation =&#34; http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.2.xsd&#34;
与2.5和2.0架构一起使用时,将应用自动检测功能。它已从3.0 +
弃用尝试:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
<bean id="circle" class="com.Circle_Constructor" autowire="autodetect" > </bean>
<bean class="com.Point" id="point">
<property name="x" value="0"></property>
<property name="y" value="0"></property>
</bean>
</beans>
希望这有帮助。